module WorkMd::Cli
Constants
- ALIAS_COMMANDS
Public Class Methods
error_frame_style()
click to toggle source
# File lib/work_md/cli.rb, line 61 def self.error_frame_style { padding: 1, title: { top_left: '(error)' } } end
execute(argv)
click to toggle source
# File lib/work_md/cli.rb, line 17 def self.execute(argv) first_argv_argument = argv.shift raise CommandMissing if first_argv_argument.nil? command = (ALIAS_COMMANDS[first_argv_argument] || first_argv_argument).capitalize Object .const_get("WorkMd::Commands::#{command}") .send(:execute, argv) rescue NameError puts help( ::TTY::Box.frame( "Command '#{first_argv_argument}' not found!", **error_frame_style ) ) rescue CommandMissing help('Welcome! =)') end
help(message = '')
click to toggle source
# File lib/work_md/cli.rb, line 39 def self.help(message = '') # rubocop:disable Layout/LineLength puts ::TTY::Box.frame( message, 'Track your work activities, write annotations, recap what you did for a week, month or specific days... and much more!', '', 'commands available:', '', '- work_md', '- work_md today', '- work_md yesterday', '- work_md tyesterday', '- work_md parse', '- work_md config', '', 'more information in github.com/henriquefernandez/work_md', padding: 1, title: { top_left: '(work_md)', bottom_right: "(v#{WorkMd::VERSION})" } ) # rubocop:enable Layout/LineLength end