-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
find: fix two examples with wrong or misleading syntax #15108
base: main
Are you sure you want to change the base?
Conversation
@@ -33,4 +33,4 @@ | |||
|
|||
- Find empty files (0 byte) or directories and delete them verbosely: | |||
|
|||
`find {{root_path}} -type {{f|d}} -empty -delete -print` | |||
`find {{root_path}} -type '{{f,d}}' -empty -delete -print` |
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 example is not wrong :D I'd rather leave it like this. The |
is fine, because you either have a f
(for file) or a d
for directory there.
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.
Have you tried to run the example?
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.
The |
is tldr syntax (similar to {{}}
), so users would change the command accordingly to either contain -type f
or -type d
.
However, I realise that the current form of the command is indeed misleading. I would wait what others have to say on this issue.
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.
No problem - though I think the example text Find empty files (0 byte) or directories and delete them verbosely
is pretty specific and doesn't make sense without the corrected syntax
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.
What was the event that made you feel that this command needed to be changed? I want to understand if it was a clarity issue or if it's just misunderstanding for not knowing the syntax.
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.
The command for the example is wrong - the syntax is wrong in two ways - I've fixed it to run and correctly work for the described purpose
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.
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.
it skips directories
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.
Well yes, the description does say "or". It can be interpretted in two ways I guess. I'll ruminate on this for a while and try to come up with a a better wording. I do think f|d is the way to go, just that the wording needs to be more precise that the user needs to choose.
@@ -9,7 +9,7 @@ | |||
|
|||
- Find files matching multiple path/name patterns: | |||
|
|||
`find {{root_path}} -path '{{**/path/**/*.ext}}' -or -name '{{*pattern*}}'` | |||
`find {{root_path}} -path '{{*/path/*/*.ext}}' -or -name '{{*pattern*}}'` |
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.
Good catch, thanks!
@@ -33,4 +33,4 @@ | |||
|
|||
- Find empty files (0 byte) or directories and delete them verbosely: |
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.
- Find empty files (0 byte) or directories and delete them verbosely: | |
- Find empty files or directories and delete them verbosely: |
I feel like the parenthese creates an unnecessary gap before the word "or"
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.
Agree - "(0 byte)" is clunky and ugly
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 like this better "List and delete empty files and directories"
common
,linux
,osx
,windows
,sunos
,android
, etc.Fixes #15107