-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
Clap derive #1067
Merged
Merged
Clap derive #1067
Changes from 19 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
6655356
Upgrade clap to 3.2
tmccombs 45d6f55
Bump MSRV to 1.56.1
tmccombs 4e7b403
Use clap-derive for option parsing
tmccombs b7f5f4a
Improve help output after switch to clap-derive
tmccombs 066ce41
Fix case of color options to ls
tmccombs e6f4805
Fix clippy warnings
tmccombs ff7336b
clap derive suggestions from epage
tmccombs a50e417
Add action clap attribute to fixed_strings
tmccombs f4c34b8
Upgrade to clap 4.0
tmccombs 5b9e302
Support powershell when guessing shell for completions
tmccombs c41d61e
Merge remote-tracking branch 'upstream/master' into clap-derive
tmccombs 86c3349
Fix name of powershell in guess_shell
tmccombs aca64c0
Actually test if exec or exec-batch is used
tmccombs 10ecb64
Fix typo in test
tmccombs bf1a6f6
Update clap depenency version
tmccombs c0b1470
Update msrv to 1.60
tmccombs c211588
Fix deprecations from clap 4.0
tmccombs b6f0088
Change thread option to take u32 instead of usize
tmccombs aec1256
Fix format
tmccombs a3622ba
Remove TODO comment
tmccombs 3782278
Improve help output
tmccombs 8500c31
Merge remote-tracking branch 'upstream/master' into clap-derive
tmccombs 36ee44a
Make help output more like what it was before use clap_derive
tmccombs 169d22f
Merge remote-tracking branch 'origin/master' into clap-derive
sharkdp 3f72ef4
Remove outdated TODO comment
sharkdp ebd48d4
Fix unit tests
sharkdp 55029e8
Minor: add missing full stop
sharkdp 5771e74
Add newlines between options
sharkdp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
target/ | ||
/autocomplete/ | ||
**/*.rs.bk |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
PROFILE=release | ||
EXE=target/$(PROFILE)/fd | ||
prefix=/usr/local | ||
bindir=$(prefix)/bin | ||
datadir=$(prefix)/share | ||
exe_name=fd | ||
|
||
$(EXE): Cargo.toml src/**/*.rs | ||
cargo build --profile $(PROFILE) | ||
|
||
.PHONY: completions | ||
completions: autocomplete/fd.bash autocomplete/fd.fish autocomplete/fd.ps1 autocomplete/_fd | ||
|
||
comp_dir=@mkdir -p autocomplete | ||
|
||
autocomplete/fd.bash: $(EXE) | ||
$(comp_dir) | ||
$(EXE) --gen-completions bash > $@ | ||
|
||
autocomplete/fd.fish: $(EXE) | ||
$(comp_dir) | ||
$(EXE) --gen-completions fish > $@ | ||
|
||
autocomplete/fd.ps1: $(EXE) | ||
$(comp_dir) | ||
$(EXE) --gen-completions powershell > $@ | ||
|
||
autocomplete/_fd: contrib/completion/_fd | ||
$(comp_dir) | ||
cp $< $@ | ||
|
||
install: $(EXE) completions | ||
install -Dm755 $(EXE) $(DESTDIR)$(bindir)/fd | ||
install -Dm644 autocomplete/fd.bash $(DESTDIR)/$(datadir)/bash-completion/completions/$(exe_name) | ||
install -Dm644 autocomplete/fd.fish $(DESTDIR)/$(datadir)/fish/vendor_completions.d/$(exe_name).fish | ||
install -Dm644 autocomplete/_fd $(DESTDIR)/$(datadir)/zsh/site-functions/_$(exe_name) | ||
install -Dm644 doc/fd.1 $(DESTDIR)/$(datadir)/man/man1/$(exe_name).1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
msrv = "1.57.0" | ||
msrv = "1.60.0" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked that we could previously generate everything with a
cargo build
. Is there a specific reason for switching to a Makefile?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion here about generating completions in the build.rs file.
Basically, getting this to work with generating the completions from build.rs was getting complicated. So I needed a way to do something after the build finished. There's probably a cargo plugin that could do this (for example https://github.com/phil-opp/cargo-post), but a makefile seemed like the most straighforward way to do it, and probably wouldn't require installing anything new.