Class: Inspec::BaseCLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/inspec/base_cli.rb

Overview

rubocop:disable Metrics/ClassLength

Class Method Summary collapse

Class Method Details

.exec_optionsObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/inspec/base_cli.rb', line 56

def self.exec_options
  target_options
  profile_options
  option :controls, type: :array,
    desc: 'A list of controls to run. Ignore all other tests.'
  option :format, type: :string,
    desc: 'Which formatter to use: cli, progress, documentation, json, json-min'
  option :color, type: :boolean, default: true,
    desc: 'Use colors in output.'
  option :attrs, type: :array,
    desc: 'Load attributes file (experimental)'
  option :cache, type: :string,
    desc: 'Use the given path for caching dependencies. (default: ~/.inspec/cache)'
  option :create_lockfile, type: :boolean, default: true,
    desc: 'Write out a lockfile based on this execution (unless one already exists)'
end

.profile_optionsObject



51
52
53
54
# File 'lib/inspec/base_cli.rb', line 51

def self.profile_options
  option :profiles_path, type: :string,
    desc: 'Folder which contains referenced profiles.'
end

.target_optionsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/inspec/base_cli.rb', line 10

def self.target_options
  option :target, aliases: :t, type: :string,
    desc: 'Simple targeting option using URIs, e.g. ssh://user:pass@host:port'
  option :backend, aliases: :b, type: :string,
    desc: 'Choose a backend: local, ssh, winrm, docker.'
  option :host, type: :string,
    desc: 'Specify a remote host which is tested.'
  option :port, aliases: :p, type: :numeric,
    desc: 'Specify the login port for a remote scan.'
  option :user, type: :string,
    desc: 'The login user for a remote scan.'
  option :password, type: :string,
    desc: 'Login password for a remote scan, if required.'
  option :key_files, aliases: :i, type: :array,
    desc: 'Login key or certificate file for a remote scan.'
  option :path, type: :string,
    desc: 'Login path to use when connecting to the target (WinRM).'
  option :sudo, type: :boolean,
    desc: 'Run scans with sudo. Only activates on Unix and non-root user.'
  option :sudo_password, type: :string,
    desc: 'Specify a sudo password, if it is required.'
  option :sudo_options, type: :string,
    desc: 'Additional sudo options for a remote scan.'
  option :sudo_command, type: :string,
    desc: 'Alternate command for sudo.'
  option :shell, type: :boolean,
    desc: 'Run scans in a subshell. Only activates on Unix.'
  option :shell_options, type: :string,
    desc: 'Additional shell options.'
  option :shell_command, type: :string,
    desc: 'Specify a particular shell to use.'
  option :ssl, type: :boolean,
    desc: 'Use SSL for transport layer encryption (WinRM).'
  option :self_signed, type: :boolean,
    desc: 'Allow remote scans with self-signed certificates (WinRM).'
  option :json_config, type: :string,
    desc: 'Read configuration from JSON file (`-` reads from stdin).'
  option :log_level, aliases: :l, type: :string,
    desc: 'Set the log level: info (default), debug, warn, error'
end