Skip to content

Create the proper Thor CLI for pdf2inspec #5

@aaronlippold

Description

@aaronlippold

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/

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions