Class: Abide::CLI::XccdfDiffCommand
- Inherits:
-
AbideCommand
- Object
- CmdParse::Command
- AbideCommand
- Abide::CLI::XccdfDiffCommand
- Defined in:
- lib/abide_dev_utils/cli/xccdf.rb
Constant Summary collapse
- CMD_NAME =
'diff'
- CMD_SHORT =
'Generates a diff report between two XCCDF files'
- CMD_LONG =
'Generates a diff report between two XCCDF files'
- CMD_FILE1_ARG =
'path to first XCCDF file'
- CMD_FILE2_ARG =
'path to second XCCDF file'
Constants included from AbideDevUtils::Config
AbideDevUtils::Config::DEFAULT_PATH
Instance Method Summary collapse
- #execute(file1, file2) ⇒ Object
-
#initialize ⇒ XccdfDiffCommand
constructor
A new instance of XccdfDiffCommand.
Methods included from AbideDevUtils::Config
config_section, #config_section, fetch, #fetch, to_h, #to_h
Constructor Details
#initialize ⇒ XccdfDiffCommand
Returns a new instance of XccdfDiffCommand.
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/abide_dev_utils/cli/xccdf.rb', line 100 def initialize super(CMD_NAME, CMD_SHORT, CMD_LONG, takes_commands: false) argument_desc(FILE1: CMD_FILE1_ARG, FILE2: CMD_FILE2_ARG) .on('-o [PATH]', '--out-file', 'Save the report as a yaml file') { |x| @data[:outfile] = x } .on('-p [PROFILE]', '--profile', 'Only diff and specific profile in the benchmarks') do |x| @data[:profile] = x end .on('-q', '--quiet', 'Show no output in the terminal') { @data[:quiet] = false } .on('--no-diff-profiles', 'Do not diff the profiles in the XCCDF files') { @data[:diff_profiles] = false } .on('--no-diff-controls', 'Do not diff the controls in the XCCDF files') { @data[:diff_controls] = false } end |
Instance Method Details
#execute(file1, file2) ⇒ Object
112 113 114 115 |
# File 'lib/abide_dev_utils/cli/xccdf.rb', line 112 def execute(file1, file2) diffreport = AbideDevUtils::XCCDF.diff(file1, file2, @data) AbideDevUtils::Output.yaml(diffreport, console: @data.fetch(:quiet, true), file: @data.fetch(:outfile, nil)) end |