Class: Boxafe::Program
- Inherits:
-
Commander::Runner
- Object
- Commander::Runner
- Boxafe::Program
- Includes:
- Commander::UI, Commander::UI::AskForClass
- Defined in:
- lib/boxafe/program.rb
Constant Summary collapse
- GLOBAL_OPTIONS =
[ :config, :verbose ]
- BACKTRACE_NOTICE =
' (use --trace to view backtrace)'
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ Program
constructor
A new instance of Program.
Constructor Details
#initialize(argv = ARGV) ⇒ Program
Returns a new instance of Program.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/boxafe/program.rb', line 12 def initialize argv = ARGV super argv program :name, 'boxafe' program :version, Boxafe::VERSION program :description, 'Secure your Dropbox with encfs.' global_option '-c', '--config PATH', 'Use a custom configuration file (defaults to ~/.boxafe.rb)' global_option '--verbose', 'Increase verbosity' command :status do |c| c.syntax = 'boxafe status' c.description = 'Display the current status and configuration' c.action do |args,| to_trace_or_not_to_trace .trace do cli.status extract() end end end command :mount do |c| c.syntax = 'boxafe mount' c.description = 'Mount configured boxes with EncFS' c.action do |args,| to_trace_or_not_to_trace .trace do cli.mount *args end end end command :unmount do |c| c.syntax = 'boxafe unmount' c.description = 'Unmount configured boxes' c.action do |args,| to_trace_or_not_to_trace .trace do cli.unmount *args end end end command :start do |c| c.syntax = 'boxafe start' c.description = 'Configure boxafe to run on startup' c.action do |args,| to_trace_or_not_to_trace .trace do cli.start *(args.push extract()) end end end command :stop do |c| c.syntax = 'boxafe stop' c.description = 'Stop boxafe from running on startup' c.action do |args,| to_trace_or_not_to_trace .trace do cli.stop *(args.push extract()) end end end default_command :status end |