-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat:add strings option; re-implement file ignore #181
Conversation
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.
Thanks for taking this on @corntoole
I left a couple of comments. Could we also add some tests for file ignore?
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.
This is looking good 👍
My only comment is that ignore-rules
sounds like it does something similar to --ignore
.
I take your point that ignore-file
could be ambiguous, how about ignore-rules-path
or --ignore-path
?
Thanks for the review. I went with |
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.
LGTM 👍
@Stebalien please take a look
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.
Some nits but this looks reasonable otherwise.
request.go
Outdated
@@ -107,7 +107,7 @@ func (req *Request) convertOptions(root *Command) error { | |||
} | |||
|
|||
kind := reflect.TypeOf(v).Kind() | |||
if kind != opt.Type() { |
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.
Can we add a comment here on why we don't need to convert string options?
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 reverted the change that excluded options with Type==Strings
. I used an older PR as a starting point that had that exception, but I noticed that it would allow requests constructed with NewRequest(...)
set non-array values. Would that comment still be necessary?
My understanding is that options with Type==String==reflect.String
is not needed because v
is already a string and does not need to be converted.
Ok, I've cut a release of go-ipfs-files. Could you squash, rebase, and update it ( |
- first step toward implementing file ignore feat(file-ignore): implement file ignore - add flags for providing a gitignore and/or list of files to ignore - construct a filter to be passed to a SerialFile feat(file-ignore): use go-ipfs-files fork; use renamed constructor feat(file-ignore): test case w. ignore rules; refactor parseArgs feat(file-ignore): ignore-rule opt is open-ended - make ignore-rules options accept a path to a file - add test case for ignore rules file feat(file-ignore): help-text for variardic opts - show StringsOption as variardic option in help-text - add test case for variardic option feat(file-ignore): rename rulesfile opt; fix typos feat(file-ignore): temp replace of go-ipfs-files - temporarily using go-ipfs-files fork until go-ipfs-files#26 is merged - trying to get ci/cd builds working - will revert before merging feat(file-ignore): refactor cli/parse.go#setOpts feat(file-ignore): cleanup parse.go; add test-case feat(file-ignore): update ignore option copytext feat(file-ignore): check opt against `optDef.Type` - revert exclusion of options with `Strings` type, so those option values are typechecked - add command test cases feat(file-ignore): add test-case w. hidden file feat(file-ignore): build against go-ipfs-files@latest feat(file-ignore): update go.mod/go.sum
56ed3c5
to
5fe469e
Compare
Ok, done. Thanks for the review |
Thanks for tackling this! |
This PR adds strings options type for passing in arrays of option values. The initial use-case for this feature is to pass multiple filepaths as options to IPFS file operations like add.
This PR also implements file-ignore by accepting a flag to use a local .gitignore file and/or an array of file paths to ignore similar to the example below:
See ipfs#3643 and fission-suite/go-ipfs#2 for more context