Class: Jets::Thor::Base
- Inherits:
-
Jets::Thor
- Object
- Jets::Thor
- Jets::Thor::Base
- Includes:
- Help, SharedOptions
- Defined in:
- lib/jets/thor/base.rb
Direct Known Subclasses
CLI, CLI::Ci, CLI::Concurrency, CLI::Dotenv, CLI::Env, CLI::Generate, CLI::Git, CLI::Maintenance, CLI::Package, CLI::Release, CLI::Schedule, CLI::Waf
Class Method Summary collapse
- .dispatch(m, args, options, config) ⇒ Object
-
.exit_on_failure? ⇒ Boolean
github.com/erikhuda/thor/issues/244 Deprecation warning: Thor exit with status 0 on errors.
-
.help_flags ⇒ Object
Also used by Jets::Thor::Auth.
-
.version_flags ⇒ Object
Also used by Jets::Thor::Auth jets version jets –version jets -v.
-
.website ⇒ Object
meant to be overriden.
Methods included from Help
#capture_stdout_for_help, #help, #paginate_output
Class Method Details
.dispatch(m, args, options, config) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/jets/thor/base.rb', line 100 def dispatch(m, args, , config) # Allow calling for help via: # jets command help # jets command -h # jets command --help # # as well thor's normal way: # # jets help command if args.length > 1 && !(args & help_flags).empty? args -= help_flags args.insert(-2, "help") end if args.length == 1 && !(args & version_flags).empty? args = ["version"] end VersionCheck.new.check! ProjectCheck.new(args).check! auth = Jets::Thor::Auth.new(args) auth.check! super rescue Jets::Api::Error::Unauthorized => e auth.(e) rescue ProjectCheck::NotProjectError puts "Not a Jets project. Please run this command from a Jets project folder.".color(:red) end |
.exit_on_failure? ⇒ Boolean
github.com/erikhuda/thor/issues/244 Deprecation warning: Thor exit with status 0 on errors. To keep this behavior, you must define ‘exit_on_failure?` in `Lono::Commands` You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.
150 151 152 |
# File 'lib/jets/thor/base.rb', line 150 def exit_on_failure? true end |
.help_flags ⇒ Object
Also used by Jets::Thor::Auth
130 131 132 |
# File 'lib/jets/thor/base.rb', line 130 def help_flags Thor::HELP_MAPPINGS + ["help"] end |
.version_flags ⇒ Object
Also used by Jets::Thor::Auth
jets version
jets --version
jets -v
138 139 140 |
# File 'lib/jets/thor/base.rb', line 138 def version_flags ["--version", "-v"] end |
.website ⇒ Object
meant to be overriden
143 144 145 |
# File 'lib/jets/thor/base.rb', line 143 def website "" end |