-
Notifications
You must be signed in to change notification settings - Fork 419
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
Adding --out flag #748
Adding --out flag #748
Conversation
scripts/generator.py
Outdated
|
||
|
||
def argument_parser(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--intermediate-only', action='store_true', | ||
help='generate intermediary files only') | ||
parser.add_argument('--include', action='store', | ||
parser.add_argument('--include', action='append', |
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.
With the change for append
here, if you pass in multiple --include
flags it will only use the last one. This causes the values to be added to an array.
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.
Actually I think we should align how we do multiple values, between --subset
and --include
.
- include:
--include path1 --include path2
- subset:
--subset path1 path2
I have a preference for how we do --subset
because it shows up clearly in the help:
usage: generator.py [-h] [--intermediate-only] [--include INCLUDE]
[--subset SUBSET [SUBSET ...]] [--out OUT]
optional arguments:
-h, --help show this help message and exit
--intermediate-only generate intermediary files only
--include INCLUDE include user specified directory of custom field
definitions
--subset SUBSET [SUBSET ...]
render a subset of the schema
--out OUT directory to store the generated files
And I suspect --subset
will play better with users using globs without quoting, and their shell expanding to a list of file names.
WDYT? Are there downsides nargs='+'
?
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.
Ah good point, didn't think of that. I don't think there should be any issue with switching it over to nargs
. I'll update it.
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.
Love this, thanks @jonathan-buttner!
Just need to align on how we do multiple args for include vs subset, see comment below.
Then we can merge 🎉
scripts/generator.py
Outdated
|
||
|
||
def argument_parser(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--intermediate-only', action='store_true', | ||
help='generate intermediary files only') | ||
parser.add_argument('--include', action='store', | ||
parser.add_argument('--include', action='append', |
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.
Actually I think we should align how we do multiple values, between --subset
and --include
.
- include:
--include path1 --include path2
- subset:
--subset path1 path2
I have a preference for how we do --subset
because it shows up clearly in the help:
usage: generator.py [-h] [--intermediate-only] [--include INCLUDE]
[--subset SUBSET [SUBSET ...]] [--out OUT]
optional arguments:
-h, --help show this help message and exit
--intermediate-only generate intermediary files only
--include INCLUDE include user specified directory of custom field
definitions
--subset SUBSET [SUBSET ...]
render a subset of the schema
--out OUT directory to store the generated files
And I suspect --subset
will play better with users using globs without quoting, and their shell expanding to a list of file names.
WDYT? Are there downsides nargs='+'
?
Example run:
|
Awesome, thank!
❤️ |
Allows for the artifacts to be output to a different directory. This is useful for users who leverage the ECS tooling to manage their Elasticsearch templates.
This PR adds the
--out
switch to specify where the generated files and docs are to be written. If the directory does not exist it will be created.