Class: Wisco::CLI
- Inherits:
-
Thor
- Object
- Thor
- Wisco::CLI
- Defined in:
- lib/wisco.rb
Class Method Summary collapse
- .exit_on_failure? ⇒ Boolean
-
.start(given_args = ARGV, config = {}) ⇒ Object
Rewrite
wisco <command> --help→wisco help <command>so Thor shows per-command help instead of treating --help as a positional argument.
Instance Method Summary collapse
- #exec(path_arg, target_dir = nil) ⇒ Object
- #fixtures(path_arg, target_dir = nil) ⇒ Object
- #init(path = nil) ⇒ Object
- #list(subcommand = nil, path = nil) ⇒ Object
- #pull(target_dir = nil) ⇒ Object
- #push(target_dir = nil) ⇒ Object
- #schema(input_file, target_dir = nil) ⇒ Object
- #status(path = nil) ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
35 36 37 |
# File 'lib/wisco.rb', line 35 def self.exit_on_failure? true end |
.start(given_args = ARGV, config = {}) ⇒ Object
Rewrite wisco <command> --help → wisco help <command> so Thor shows
per-command help instead of treating --help as a positional argument.
41 42 43 44 45 46 47 48 49 |
# File 'lib/wisco.rb', line 41 def self.start(given_args = ARGV, config = {}) if given_args.length >= 2 && (given_args.include?('--help') || given_args.include?('-h')) && !given_args.first.start_with?('-') super(['help', given_args.first], config) else super end end |
Instance Method Details
#exec(path_arg, target_dir = nil) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/wisco.rb', line 107 def exec(path_arg, target_dir = nil) Wisco::Commands::Exec.run( path_arg, target_dir || Dir.pwd, input: [:input], pagination: [:pagination], verbose: [:verbose], extended: [:extended], closure: [:closure], config_fields: [:config_fields], continue: [:continue], extended_input_schema: [:extended_input_schema], extended_output_schema: [:extended_output_schema], debug: [:debug], summary: [:summary], summary_lines: [:'summary-lines'], auto_refresh: [:'auto-refresh'] ) end |
#fixtures(path_arg, target_dir = nil) ⇒ Object
141 142 143 144 145 146 147 148 149 |
# File 'lib/wisco.rb', line 141 def fixtures(path_arg, target_dir = nil) Wisco::Commands::Fixtures.run( path_arg, target_dir || Dir.pwd, overwrite: [:overwrite], ruby: [:ruby], debug: [:debug] ) end |
#init(path = nil) ⇒ Object
60 61 62 |
# File 'lib/wisco.rb', line 60 def init(path = nil) Wisco::Commands::Init.run(path || Dir.pwd, profile: [:profile]) end |
#list(subcommand = nil, path = nil) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/wisco.rb', line 74 def list(subcommand = nil, path = nil) if subcommand&.match?(%r{^[./~\\]|^[A-Za-z]:[/\\]}) path = subcommand subcommand = nil end Wisco::Commands::List.run(subcommand, path || Dir.pwd, sort: [:sort], format: [:format]) end |
#pull(target_dir = nil) ⇒ Object
187 188 189 190 191 192 193 194 |
# File 'lib/wisco.rb', line 187 def pull(target_dir = nil) Wisco::Commands::Pull.run( target_dir || Dir.pwd, what: [:what], title: [:title], debug: [:debug] ) end |
#push(target_dir = nil) ⇒ Object
162 163 164 165 166 167 168 169 170 171 |
# File 'lib/wisco.rb', line 162 def push(target_dir = nil) Wisco::Commands::Push.run( target_dir || Dir.pwd, title: [:title], notes: [:notes], folder: [:folder], verbose: [:verbose], debug: [:debug] ) end |
#schema(input_file, target_dir = nil) ⇒ Object
240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/wisco.rb', line 240 def schema(input_file, target_dir = nil) Wisco::Commands::Schema.run( input_file, target_dir || Dir.pwd, format: [:format], ruby_options: [:ruby_options], col_sep: [:col_sep], output: [:save], debug: [:debug] ) end |
#status(path = nil) ⇒ Object
202 203 204 |
# File 'lib/wisco.rb', line 202 def status(path = nil) Wisco::Commands::Status.run(path || Dir.pwd) end |
#version ⇒ Object
53 54 55 |
# File 'lib/wisco.rb', line 53 def version puts "#{DISPLAY_NAME} v#{VERSION}" end |