Skip to content
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

Revisit CLI options #390

Closed
nishakm opened this issue Aug 16, 2019 · 6 comments · Fixed by #443
Closed

Revisit CLI options #390

nishakm opened this issue Aug 16, 2019 · 6 comments · Fixed by #443
Assignees
Labels
grokability Make the project easier to approach and understand hygiene Fixes for linting and style errors
Milestone

Comments

@nishakm
Copy link
Contributor

nishakm commented Aug 16, 2019

Problem Statement
The command line options seem cluttered. Let's try to structure them better

Describe the Proposal
Because we are dealing with user interface and downstream use, this will break API and hence qualify for a major version increase

@nishakm nishakm added this to the Near Future milestone Aug 16, 2019
@nishakm nishakm modified the milestones: Near Future, Release 1.0.0 Aug 28, 2019
@nishakm nishakm added grokability Make the project easier to approach and understand hygiene Fixes for linting and style errors labels Aug 28, 2019
@rnjudge
Copy link
Contributor

rnjudge commented Sep 5, 2019

I just noticed there is no information on how to use the reporting options in tern. None of the subparser options are displayed on the help screen.

usage: Tern [-h] [-l] [-c] [-k] [-b] [-r] [-V] {report} ...

           Tern is a container image component curation tool. Tern retrieves
    information about packages that are installed in a container image.
    Learn more at https://github.com/vmware/tern

positional arguments:
  {report}              Subcommands
    report              Create a report

optional arguments:
  -h, --help            show this help message and exit
  -l, --log-stream      Stream logs to the console;Useful when running in a shell
  -c, --clear-cache     Clear the cache before running
  -k, --keep-working-dir
                        Keep the working directory after execution;Useful when debugging container images
  -b, --bind-mount      Treat working directory as a bind mount;Needed when running from within a container
  -r, --redo            Repopulate the cache for found layers
  -V, --version         show program's version number and exit

Is this intentional? I would argue the different options for generating reports are more important than some of the other optional arguments.

@nishakm
Copy link
Contributor Author

nishakm commented Sep 5, 2019

You have to do tern report -h to get the subparser options. Perhaps the description can be changed from Create a report to Create a BoM report. Run 'tern report -h' for command line options or something like that.

@rnjudge
Copy link
Contributor

rnjudge commented Sep 5, 2019

@nishakm What else would you like to see cleaned up on the command line?

@nishakm
Copy link
Contributor Author

nishakm commented Sep 6, 2019

@nishakm What else would you like to see cleaned up on the command line?
-V, --version show program's version number and exit
Maybe this should be -v?

-k, --keep-working-dir
                        Keep the working directory after execution;Useful when debugging container images

Maybe a shorter -- option

  -b, --bind-mount      Treat working directory as a bind mount;Needed when running from within a container

Maybe change ; into . and same thing for the -k option?

$ tern report -h
usage: Tern report [-h] [-d DOCKERFILE] [-i DOCKER_IMAGE] [-s]
                   [-m REPORT_MODULE] [-f FILE]

optional arguments:
  -h, --help            show this help message and exit
  -d DOCKERFILE, --dockerfile DOCKERFILE
                        Dockerfile used to build the Docker image
  -i DOCKER_IMAGE, --docker-image DOCKER_IMAGE
                        Docker image that exists locally - image:tag The
                        option can be used to pull docker images by digest as
                        well - <repo>@<digest-type>:<digest>
  -s, --summary         Summarize the report as a list of packages with
                        associated information
  -m REPORT_MODULE, --report-format REPORT_MODULE
                        Format the report using one of the available formats:
                        spdxtagvalue, json, yaml
  -f FILE, --file FILE  Write the report to a file; If no file is given the
                        default file in utils/constants.py will be used

What do you think about using -f REPORT_FORMAT, --report-format REPORT_FORMAT and then using -o FILE, --output-file FILE. This way we can use -m for something else that might come up.

@rnjudge
Copy link
Contributor

rnjudge commented Sep 6, 2019

@nishakm What else would you like to see cleaned up on the command line?
-V, --version show program's version number and exit
Maybe this should be -v?

I have seen -v typically used for verbose mode. Do you ever think we will want a verbose report? (I think I already asked you this question in issue #363 but it comes up again)

-k, --keep-working-dir
                        Keep the working directory after execution;Useful when debugging container images

Maybe a shorter -- option

Agree. Maybe --keep-wd? --kwd to me looks like three different arguments but maybe that's just me.

  -b, --bind-mount      Treat working directory as a bind mount;Needed when running from within a container

Maybe change ; into . and same thing for the -k option?

Sounds good.

$ tern report -h
usage: Tern report [-h] [-d DOCKERFILE] [-i DOCKER_IMAGE] [-s]
                   [-m REPORT_MODULE] [-f FILE]

optional arguments:
  -h, --help            show this help message and exit
  -d DOCKERFILE, --dockerfile DOCKERFILE
                        Dockerfile used to build the Docker image
  -i DOCKER_IMAGE, --docker-image DOCKER_IMAGE
                        Docker image that exists locally - image:tag The
                        option can be used to pull docker images by digest as
                        well - <repo>@<digest-type>:<digest>
  -s, --summary         Summarize the report as a list of packages with
                        associated information
  -m REPORT_MODULE, --report-format REPORT_MODULE
                        Format the report using one of the available formats:
                        spdxtagvalue, json, yaml
  -f FILE, --file FILE  Write the report to a file; If no file is given the
                        default file in utils/constants.py will be used

What do you think about using -f REPORT_FORMAT, --report-format REPORT_FORMAT and then using -o FILE, --output-file FILE. This way we can use -m for something else that might come up.

Works for me.

@rnjudge rnjudge self-assigned this Sep 6, 2019
@nishakm
Copy link
Contributor Author

nishakm commented Sep 6, 2019

I have seen -v typically used for verbose mode. Do you ever think we will want a verbose report? (I think I already asked you this question in issue #363 but it comes up again)

I like the idea you proposed to move the verbose report to its own plugin. In which case v for verbose will not be needed. We have -l which is kindof what verbose means in other tools i.e. be talkative during execution.

Agree. Maybe --keep-wd? --kwd to me looks like three different arguments but maybe that's just me.

I think it's enough to say --keep-wd

rnjudge added a commit to rnjudge/tern that referenced this issue Sep 6, 2019
Tern's command line is a bit cluttered. This commit attempts to
re-structure some of the {report} positional arguments. Namely:

- Use '-f REPORT_FORMAT' to denote report format instead of '-m'
- Use '-o FILE' to denote an report output file instead of '-f'
- Shorten '--keep-working-dir' option to '--keep-wd'
- Change '-V' to '-v' in order to get the version

There are a few other various style imorovemenets to the 'tern -h'
output such as changing ';' to '.' and removing an indentation.

This commit also updates the README documenation to reflect the
updated command line options, updates the invocation of the tests in
ci/test_files_touched.py and updates tern/report/report.py to reflect
the updated argument name values where applicable.

Since this commit changes Tern's user interface, it will break API and
not be compatible with downstream versions.

Resolves tern-tools#390

Signed-off-by: Rose Judge <[email protected]>
rnjudge added a commit to rnjudge/tern that referenced this issue Sep 9, 2019
Tern's command line is a bit cluttered. This commit attempts to
re-structure some of the {report} positional arguments. Namely:

- Use '-f REPORT_FORMAT' to denote report format instead of '-m'
- Use '-o FILE' to denote an report output file instead of '-f'
- Shorten '--keep-working-dir' option to '--keep-wd'
- Change '-V' to '-v' in order to get the version

There are a few other various style imorovemenets to the 'tern -h'
output such as changing ';' to '.' and removing an indentation.

This commit also updates the README documenation to reflect the
updated command line options, updates the invocation of the tests in
ci/test_files_touched.py and updates tern/report/report.py to reflect
the updated argument name values where applicable.

Since this commit changes Tern's user interface, it will break API and
not be compatible with downstream versions.

Resolves tern-tools#390

Signed-off-by: Rose Judge <[email protected]>
nishakm pushed a commit that referenced this issue Sep 9, 2019
Tern's command line is a bit cluttered. This commit attempts to
re-structure some of the {report} positional arguments. Namely:

- Use '-f REPORT_FORMAT' to denote report format instead of '-m'
- Use '-o FILE' to denote an report output file instead of '-f'
- Shorten '--keep-working-dir' option to '--keep-wd'
- Change '-V' to '-v' in order to get the version

There are a few other various style imorovemenets to the 'tern -h'
output such as changing ';' to '.' and removing an indentation.

This commit also updates the README documenation to reflect the
updated command line options, updates the invocation of the tests in
ci/test_files_touched.py and updates tern/report/report.py to reflect
the updated argument name values where applicable.

Since this commit changes Tern's user interface, it will break API and
not be compatible with downstream versions.

Resolves #390

Signed-off-by: Rose Judge <[email protected]>
rnjudge added a commit to rnjudge/tern that referenced this issue Jun 5, 2020
Tern's command line is a bit cluttered. This commit attempts to
re-structure some of the {report} positional arguments. Namely:

- Use '-f REPORT_FORMAT' to denote report format instead of '-m'
- Use '-o FILE' to denote an report output file instead of '-f'
- Shorten '--keep-working-dir' option to '--keep-wd'
- Change '-V' to '-v' in order to get the version

There are a few other various style imorovemenets to the 'tern -h'
output such as changing ';' to '.' and removing an indentation.

This commit also updates the README documenation to reflect the
updated command line options, updates the invocation of the tests in
ci/test_files_touched.py and updates tern/report/report.py to reflect
the updated argument name values where applicable.

Since this commit changes Tern's user interface, it will break API and
not be compatible with downstream versions.

Resolves tern-tools#390

Signed-off-by: Rose Judge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grokability Make the project easier to approach and understand hygiene Fixes for linting and style errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants