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

Create the proper Thor CLI for pdf2inspec #5

Open
aaronlippold opened this issue Sep 12, 2017 · 0 comments
Open

Create the proper Thor CLI for pdf2inspec #5

aaronlippold opened this issue Sep 12, 2017 · 0 comments
Assignees

Comments

@aaronlippold
Copy link
Owner

We should be able to break apart the options of our program:
These are examples but get the idea across

For things like utility functions so that each of you can test your parts.

pdf2inspec parse myfile.pdf --raw -o RawUncleanFile.txt
pdf2inspec parse http://link.com/myfile.pdf -o cleanfile.txt
pdf2inspec test parselet
pdf2inspec test csv_parser

pdf2inspec xls2hash --xlsx=</path/to/file.xslx>

Or whatever options we think makes sense. We should also setup the standard pattern of the workflow. In my mind it would be something like:

For the main program, I am open to suggestions here as to what the best user experience is.

However, we do have to keep in mind that in the end this will be part of a CI/CD pipeline so we have to have everything work over CLI passing in data from either files or http locations. We can start with file locations.

pdf2inspec create-profile --xls cis2nist.xls --pdf mypdfprofile.pdf --profile 'mybenchmark'

Which would:

  1. tell inspec to run the command inspec init profile mybenchmark in the given location and return the path of the controls directory that is created. ( note: I think if we look at the Thor cli for InSpec we should be able to find out which commands to call directly rather than invoking a shell command )
    A. delete the example.rb control file from the controls directory
  2. parse our two given files
  3. start the converter passing the data from (2) and the path from (1)
  4. Parse and create
  5. Report that it created the profile 'myBenchark', processing 'X' controls

See: https://github.com/erikhuda/thor/wiki/Getting-Started
see: https://www.bounga.org/ruby/2011/09/12/thor-a-command-line-scripting-tool/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants