Class: Metanorma::Cli::Command
- Inherits:
-
Thor
- Object
- Thor
- Metanorma::Cli::Command
- Defined in:
- lib/metanorma/cli/command.rb
Instance Method Summary collapse
- #compile(file_name = nil) ⇒ Object
- #list_extensions(type = nil) ⇒ Object
- #new(name) ⇒ Object
- #setup ⇒ Object
- #version ⇒ Object
Instance Method Details
#compile(file_name = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/metanorma/cli/command.rb', line 33 def compile(file_name = nil) if file_name && ![:version] Metanorma::Cli.load_flavors Metanorma::Cli::Compiler.compile(file_name, .dup) elsif [:version] invoke(:version, [], type: [:type], format: [:format]) elsif .keys.size >= 2 UI.say("Need to specify a file to process") else invoke :help end end |
#list_extensions(type = nil) ⇒ Object
60 61 62 63 64 |
# File 'lib/metanorma/cli/command.rb', line 60 def list_extensions(type = nil) single_type_extensions(type) || all_type_extensions rescue LoadError UI.say("Couldn't load #{type}, please provide a valid type!") end |
#new(name) ⇒ Object
17 18 19 |
# File 'lib/metanorma/cli/command.rb', line 17 def new(name) create_new_document(name, .dup) end |