Class: Licensed::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/licensed/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

If an error occurs (e.g. a missing command or argument), exit 1.

Returns:

  • (Boolean)


92
93
94
# File 'lib/licensed/cli.rb', line 92

def self.exit_on_failure?
  true
end

Instance Method Details

#cacheObject



17
18
19
20
# File 'lib/licensed/cli.rb', line 17

def cache
  run Licensed::Commands::Cache.new(config: config),
      force: options[:force], sources: options[:sources], reporter: options[:format]
end

#envObject



67
68
69
# File 'lib/licensed/cli.rb', line 67

def env
  run Licensed::Commands::Environment.new(config: config), reporter: options[:format]
end

#listObject



42
43
44
# File 'lib/licensed/cli.rb', line 42

def list
  run Licensed::Commands::List.new(config: config), sources: options[:sources], reporter: options[:format], licenses: options[:licenses]
end

#migrateObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/licensed/cli.rb', line 76

def migrate
  shell = Thor::Base.shell.new
  case options["from"]
  when "v1"
    Licensed::Migrations::V2.migrate(options["config"])
  when "v2"
    shell.say "No configuration or cached file migration needed."
    shell.say "Please see the documentation at https://github.com/github/licensed/tree/master/docs/migrations/v3.md for details."
  else
    shell.say "Unrecognized option from=#{options["from"]}", :red
    CLI.command_help(shell, "migrate")
    exit 1
  end
end

#noticesObject



51
52
53
# File 'lib/licensed/cli.rb', line 51

def notices
  run Licensed::Commands::Notices.new(config: config), sources: options[:sources]
end

#statusObject



29
30
31
# File 'lib/licensed/cli.rb', line 29

def status
  run Licensed::Commands::Status.new(config: config), sources: options[:sources], reporter: options[:format]
end

#versionObject



58
59
60
# File 'lib/licensed/cli.rb', line 58

def version
  puts Licensed::VERSION
end