Class: Menu::Generator
- Inherits:
-
Object
- Object
- Menu::Generator
- Defined in:
- lib/menu/generator.rb
Overview
Menu generator
Class Method Summary collapse
-
.make_config_menu ⇒ Slop::Result
Creates the config menu.
-
.make_main_menu ⇒ Slop::Result
Creates the main menu.
-
.make_scheduled_menu ⇒ Slop::Result
Creates the repeatables menu.
Class Method Details
.make_config_menu ⇒ Slop::Result
Creates the config menu.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/menu/generator.rb', line 45 def self. opts = Slop::Options.new opts. = "usage: #{$PROGRAM_NAME} config [option] [value]" opts.string "url", "Set the JIRA Server URL." opts.string "shift_start", "Set shift start time. Format: HH:mm, e.g. '10:00'." opts.string "shift_end", "Set shift end time. Format: HH:mm, e.g. '18:00'." opts.bool "list", "Lists all configuration values." Slop::Parser.new(opts).parse(ARGV[1..ARGV.count - 1]) rescue Slop::MissingArgument => e puts e exit 1 end |
.make_main_menu ⇒ Slop::Result
Creates the main menu.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/menu/generator.rb', line 28 def self. Slop.parse(ARGV[0..1]) do |o| o.bool "setup", "Run the initial setup wizard." o.bool "login", "Login with your JIRA credentials." o.bool "logout", "Logout current user." o.bool "config", "Update configuration." o.bool "scheduled", "Manage scheduled issues." o.on "--version", "-v", "Prints jira-logwork version." do puts "jira-logwork v#{Constants::VERSION}" exit end end end |
.make_scheduled_menu ⇒ Slop::Result
Creates the repeatables menu.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/menu/generator.rb', line 62 def self. opts = Slop::Options.new opts. = "usage: scheduled [command] [ISSUE_ID] [options]" opts.string "add", "Add a new scheduled issue. Syntax: 'add [ISSUE_ID] [Options]', e.g. add ABC-13 10:00 2h30m." opts.string "remove", "Remove a scheduled issue from Database. Syntax 'remove [ISSUE_ID]', e.g. remove ABC-13. You can specify the --date option to remove from a specific date." opts.bool "list", "List scheduled issues." opts.separator "Options:" opts.string "--repeat", "An integer that indicates the day of the week the issue is repeated: 0: Everyday, 1: Monday - 7: Sunday." opts.string "--date", "A date the issue will be scheduled in MM/DD/YYYY format." opts.string "--start_time", "Time in 24h format (optional), e.g. 10:00. " opts.string "--duration", "A duration of the issue (optional), e.g. 30m, 1h30m, etc." Slop::Parser.new(opts).parse(ARGV[1..ARGV.count - 1]) rescue Slop::MissingArgument => e puts e exit 1 end |