Class: FhirPackagesManager::CLI
- Inherits:
-
Object
- Object
- FhirPackagesManager::CLI
- Defined in:
- lib/fhir_packages_manager/cli.rb
Overview
Command-line entry point backing the fhir_packages_manager executable.
See the "CLI" section of the README for usage examples.
Constant Summary collapse
- COMMANDS =
Returns the supported subcommands.
%w[fetch check list sync].freeze
- BANNER =
Returns usage text shown on --help and on invalid invocations.
<<~USAGE Usage: fhir_packages_manager COMMAND package[@version] [package[@version] ...] [options] Commands: fetch Download packages into the destination folder check Report which registry (if any) has each package/version list List every version of a package available across registries sync Download every non-ignored version not already in the destination folder USAGE
Class Method Summary collapse
-
.run(argv) ⇒ void
Parses argv and runs the requested command (
fetchorcheck).
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ void
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
33 34 35 36 |
# File 'lib/fhir_packages_manager/cli.rb', line 33 def initialize(argv) @argv = argv.dup @options = { destination: './fhir_packages', registries: [] } # : Hash[Symbol, untyped] end |
Class Method Details
.run(argv) ⇒ void
This method returns an undefined value.
Parses argv and runs the requested command (fetch or check).
28 29 30 |
# File 'lib/fhir_packages_manager/cli.rb', line 28 def self.run(argv) new(argv).run end |
Instance Method Details
#run ⇒ void
This method returns an undefined value.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fhir_packages_manager/cli.rb', line 39 def run parser.parse!(@argv) command = @argv.shift package_specs = @argv return usage_error(1) if !COMMANDS.include?(command) || package_specs.empty? return usage_error('Error: at least one --registry URL is required') if @options[:registries].empty? dispatch(command, package_specs) end |