Class: HexaPDF::CLI::Application
- Inherits:
-
CmdParse::CommandParser
- Object
- CmdParse::CommandParser
- HexaPDF::CLI::Application
- Defined in:
- lib/hexapdf/cli.rb
Overview
The CmdParse::CommandParser class that is used for running the CLI application.
Instance Attribute Summary collapse
-
#force ⇒ Object
readonly
Specifies whether an operation should be forced.
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
:nodoc:.
-
#parse(argv = ARGV) ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ Application
:nodoc:
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/hexapdf/cli.rb', line 66 def initialize #:nodoc: super(handle_exceptions: :no_help) main_command..program_name = "hexapdf" main_command..version = HexaPDF::VERSION add_command(HexaPDF::CLI::Info.new) add_command(HexaPDF::CLI::Files.new) add_command(HexaPDF::CLI::Images.new) add_command(HexaPDF::CLI::Inspect.new) add_command(HexaPDF::CLI::Modify.new) add_command(HexaPDF::CLI::Optimize.new) add_command(HexaPDF::CLI::Merge.new) add_command(CmdParse::HelpCommand.new) add_command(CmdParse::VersionCommand.new) @force = false .on("--[no-]force", "Force overwriting existing files. Default: false") do |f| @force = f end end |
Instance Attribute Details
#force ⇒ Object (readonly)
Specifies whether an operation should be forced. For example, if an existing file should be overwritten.
64 65 66 |
# File 'lib/hexapdf/cli.rb', line 64 def force @force end |
Instance Method Details
#parse(argv = ARGV) ⇒ Object
:nodoc:
86 87 88 89 |
# File 'lib/hexapdf/cli.rb', line 86 def parse(argv = ARGV) #:nodoc: ARGV.unshift('help') if ARGV.empty? super end |