Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve filename completion behaviour #3

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Improve filename completion (#3)
- Stop printing spec errors (#2, fixes #1)

## 0.2.0
Expand Down
3 changes: 2 additions & 1 deletion examples/fake_git.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ let commit =
let open Arg_parser in
let+ _amend = flag [ "amend"; "a" ]
and+ _branch = named_opt [ "b"; "branch" ] branch_conv
and+ _message = named_opt [ "m"; "message" ] string in
and+ _message = named_opt [ "m"; "message" ] string
and+ _files = pos_all file in
()
;;

Expand Down
6 changes: 6 additions & 0 deletions src/climate/completion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ module Add_reply = struct
"Takes the word under the cursor (just the portion up to the cursor) and \
completes with files in the current directory."
; raw "COMPREPLY+=($(compgen -A file -- \"$1\"))"
; comment
"Tell the shell that completions will be filenames. This allows for ergonomic \
improvements such as appending a slash to directories and omitting the space \
after completions so completion of paths can continue if the user presses tab \
again."
; raw "compopt -o filenames"
]
;;

Expand Down
Loading