-
Notifications
You must be signed in to change notification settings - Fork 228
cmd: add -a option to allow inclusion of hidden files
#113
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ var ( | |
| flagNamespace = flag.String("ns", "default", "") | ||
| flagPkgCmt = flag.String("c", "", "") | ||
| flagInclude = flag.String("include", "*.*", "") | ||
| flagAllFiles = flag.Bool("a", false, "") | ||
| ) | ||
|
|
||
| const helpText = `statik [options] | ||
|
|
@@ -59,6 +60,7 @@ Options: | |
|
|
||
| -ns The namespace where assets will exist, "default" by default. | ||
| -f Override destination if it already exists, false by default. | ||
| -a Include hidden files, false by default. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the What do you think?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, sounds great. I will update it. |
||
| -include Wildcard to filter files to include, "*.*" by default. | ||
| -m Ignore modification times for deterministic output, false by default. | ||
| -Z Do not use compression, false by default. | ||
|
|
@@ -207,7 +209,7 @@ func generateSource(srcPath string, includes string) (file *os.File, err error) | |
| // No entry is needed for directories in a zip file. | ||
| // Each file is represented with a path, no directory | ||
| // entities are required to build the hierarchy. | ||
| if fi.IsDir() || strings.HasPrefix(fi.Name(), ".") { | ||
| if fi.IsDir() || (!*flagAllFiles && strings.HasPrefix(fi.Name(), ".")) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
| return nil | ||
| } | ||
| relPath, err := filepath.Rel(srcPath, path) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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'd change it into
flagIgnoreDotFilesto be more inline with its real purpose.Uh oh!
There was an error while loading. Please reload this page.
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 think, the name
flagIgnoreDotFileshas a meaning opposite to-a("do not ignore entries starting with .")When a user runs
statik -aorstatik -a=true, they want to include dot files.So,
flagIgnoreDotFilesshould be equal to! flag.Bool("a"), which is very uncommon.I don't mind renaming
flagAllFiles. May beflagDoNotIgnoreDotFilesis less controversial ?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.
Maybe
considerDotFilesis easier to grok?