summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples
diff options
context:
space:
mode:
authorBenjamin Sanders <ben@Benjamins-MacBook-Pro.local>2025-10-11 10:34:24 -0400
committerBenjamin Sanders <ben@Benjamins-MacBook-Pro.local>2025-10-11 10:34:24 -0400
commit5571dc766e2143e39762ff0b47c41d1c2e154f4c (patch)
treef4f124d314a7e76c04484515aa0fd1f2e271a601 /vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples
parent359f3309c97fc894b63e0a295c76ab298504d635 (diff)
Vendor bundled gems for deployment
Diffstat (limited to 'vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples')
-rwxr-xr-xvendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/help_dialogue.rb45
-rwxr-xr-xvendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/logging.rb35
-rwxr-xr-xvendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/trace.rb20
3 files changed, 100 insertions, 0 deletions
diff --git a/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/help_dialogue.rb b/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/help_dialogue.rb
new file mode 100755
index 0000000..c99ccc1
--- /dev/null
+++ b/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/help_dialogue.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+$LOAD_PATH.unshift File.join(__dir__, "..", "lib")
+
+require "mercenary"
+
+# This example sets the logging mode of mercenary to
+# debug. Logging messages from "p.logger.debug" will
+# be output to STDOUT.
+
+Mercenary.program(:help_dialogue) do |p|
+ p.version "2.0.1"
+ p.description "An example of the help dialogue in Mercenary"
+ p.syntax "help_dialogue <subcommand>"
+
+ p.command(:some_subcommand) do |c|
+ c.version "1.4.2"
+ c.syntax "some_subcommand <subcommand> [options]"
+ c.description "Some subcommand to do something"
+ c.option "an_option", "-o", "--option", "Some option"
+ c.alias(:blah)
+
+ c.command(:yet_another_sub) do |f|
+ f.syntax "yet_another_sub [options]"
+ f.description "Do amazing things"
+ f.option "blah", "-b", "--blah", "Trigger blah flag"
+ f.option "heh", "-H ARG", "--heh ARG", "Give a heh"
+
+ f.action do |args, options|
+ print "Args: "
+ p args
+ print "Opts: "
+ p options
+ end
+ end
+ end
+
+ p.command(:another_subcommand) do |c|
+ c.syntax "another_subcommand <subcommand> [options]"
+ c.description "Another subcommand to do something different."
+ c.option "an_option", "-O", "--option", "Some option"
+ c.option "another_options", "--pluginzzz", "Set where the plugins should be found from"
+ end
+end
diff --git a/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/logging.rb b/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/logging.rb
new file mode 100755
index 0000000..3a38229
--- /dev/null
+++ b/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/logging.rb
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+$LOAD_PATH.unshift File.join(__dir__, "..", "lib")
+
+require "mercenary"
+
+# This example sets the logging mode of mercenary to
+# debug. Logging messages from "p.logger.debug" will
+# be output to STDOUT.
+
+Mercenary.program(:logger_output) do |p|
+ p.version "5.2.6"
+ p.description "An example of turning on logging for Mercenary."
+ p.syntax "logger_output"
+
+ p.logger.info "The default log level is INFO. So this will output."
+ p.logger.debug "Since DEBUG is below INFO, this will not output."
+
+ p.logger(Logger::DEBUG)
+ p.logger.debug "Logger level now set to DEBUG. So everything will output."
+
+ p.logger.debug "Example of DEBUG level message."
+ p.logger.info "Example of INFO level message."
+ p.logger.warn "Example of WARN level message."
+ p.logger.error "Example of ERROR level message."
+ p.logger.fatal "Example of FATAL level message."
+ p.logger.unknown "Example of UNKNOWN level message."
+
+ p.action do |_args, _options|
+ p.logger(Logger::INFO)
+ p.logger.debug "Logger level back to INFO. This line will not output."
+ p.logger.info "This INFO message will output."
+ end
+end
diff --git a/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/trace.rb b/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/trace.rb
new file mode 100755
index 0000000..cca6b6c
--- /dev/null
+++ b/vendor/bundle/ruby/3.4.0/gems/mercenary-0.4.0/examples/trace.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+$LOAD_PATH.unshift File.join(__dir__, "..", "lib")
+
+require "mercenary"
+
+# This example sets the logging mode of mercenary to
+# debug. Logging messages from "p.logger.debug" will
+# be output to STDOUT.
+
+Mercenary.program(:trace) do |p|
+ p.version "2.0.1"
+ p.description "An example of traces in Mercenary"
+ p.syntax "trace <subcommand>"
+
+ p.action do |_, _|
+ raise ArgumentError, "YOU DID SOMETHING TERRIBLE YOU BUFFOON"
+ end
+end