diff options
author | Dante Catalfamo | 2023-12-30 02:18:57 -0500 |
---|---|---|
committer | Dante Catalfamo | 2023-12-30 02:18:57 -0500 |
commit | 059e609290c9f0b74eae8ad589529eeb5286a8a9 (patch) | |
tree | 4724ffb45d6bc3e51bf8ee0e65bc1e687c3bd2ff | |
parent | 6fb8b788ba966bd49b90712cf35ba199aad62fe3 (diff) | |
download | blog-059e609290c9f0b74eae8ad589529eeb5286a8a9.tar.gz blog-059e609290c9f0b74eae8ad589529eeb5286a8a9.tar.bz2 blog-059e609290c9f0b74eae8ad589529eeb5286a8a9.zip |
bash-incremental: Add some details for code
-rw-r--r-- | content/posts/bash-incremental-directory-completion/index.org | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/content/posts/bash-incremental-directory-completion/index.org b/content/posts/bash-incremental-directory-completion/index.org index 1bce8b3..95369fe 100644 --- a/content/posts/bash-incremental-directory-completion/index.org +++ b/content/posts/bash-incremental-directory-completion/index.org @@ -114,11 +114,15 @@ function _repo_completions { complete -F _repo_completions repo #+end_src +In the above code, =repo cd= changes directory to =~/src= and the =-S +/= option for =compgen= will append a trailing (suffix) slash to the +end of the suggestion. + The key here is that you can use =compopt= to dynamically change completion options while running the completion, which lets me check how many directories deep we are into the completion by counting slashes, and disable appending a space until we're a full three directories deep into the completion. - -existing resouces https://iridakos.com/programming/2018/03/01/bash-programmable-completion-tutorial +Here is a good resource on bash completion for further reading. +https://iridakos.com/programming/2018/03/01/bash-programmable-completion-tutorial |