rbcli 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -1
  3. data/Gemfile.lock +7 -2
  4. data/README.md +43 -3
  5. data/bin/console +1 -1
  6. data/bin/setup +1 -1
  7. data/docs/404.html +12 -0
  8. data/docs/advanced/automatic_updates/index.html +12 -0
  9. data/docs/advanced/command_types/index.html +13 -1
  10. data/docs/advanced/distributed_state_locking/index.html +14 -2
  11. data/docs/advanced/hooks/index.html +12 -0
  12. data/docs/advanced/remote_execution/index.html +822 -0
  13. data/docs/advanced/state_storage/index.html +12 -0
  14. data/docs/advanced/user_config_files/index.html +12 -0
  15. data/docs/development/code_of_conduct/index.html +12 -0
  16. data/docs/development/contributing/index.html +15 -3
  17. data/docs/development/license/index.html +12 -0
  18. data/docs/imported/changelog/index.html +82 -7
  19. data/docs/imported/quick_reference/index.html +40 -1
  20. data/docs/index.html +15 -0
  21. data/docs/search/search_index.json +52 -12
  22. data/docs/sitemap.xml +23 -18
  23. data/docs/tutorial/10-getting_started/index.html +12 -0
  24. data/docs/tutorial/20-project_layout/index.html +12 -0
  25. data/docs/tutorial/30-your_first_command/index.html +12 -0
  26. data/docs/tutorial/40-options_parameters_and_arguments/index.html +12 -0
  27. data/docs/tutorial/50-publishing/index.html +12 -0
  28. data/docs/whoami/index.html +12 -0
  29. data/docs-src/docs/advanced/command_types.md +1 -1
  30. data/docs-src/docs/advanced/remote_execution.md +56 -0
  31. data/docs-src/docs/development/contributing.md +1 -1
  32. data/docs-src/docs/imported/changelog.md +12 -1
  33. data/docs-src/docs/imported/quick_reference.md +23 -1
  34. data/docs-src/docs/index.md +2 -0
  35. data/docs-src/mkdocs.yml +1 -0
  36. data/exe/rbcli +1 -1
  37. data/lib/rbcli/autoupdate/autoupdate.rb +1 -1
  38. data/lib/rbcli/autoupdate/gem_updater.rb +1 -1
  39. data/lib/rbcli/autoupdate/github_updater.rb +1 -1
  40. data/lib/rbcli/configuration/config.rb +1 -1
  41. data/lib/rbcli/configuration/configurate.rb +7 -2
  42. data/lib/rbcli/engine/command.rb +25 -3
  43. data/lib/rbcli/engine/load_project.rb +1 -1
  44. data/lib/rbcli/engine/parser.rb +10 -2
  45. data/lib/rbcli/logging/logging.rb +1 -1
  46. data/lib/rbcli/remote_exec/remote_exec.rb +187 -0
  47. data/lib/rbcli/scriptwrapping/scriptwrapper.rb +25 -5
  48. data/lib/rbcli/stateful_systems/configuratestorage.rb +1 -1
  49. data/lib/rbcli/stateful_systems/state_storage.rb +1 -1
  50. data/lib/rbcli/stateful_systems/storagetypes/localstate.rb +1 -1
  51. data/lib/rbcli/stateful_systems/storagetypes/remote_state_connectors/dynamodb.rb +1 -1
  52. data/lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb +1 -1
  53. data/lib/rbcli/util/hash_deep_symbolize.rb +1 -1
  54. data/lib/rbcli/util/string_colorize.rb +1 -1
  55. data/lib/rbcli/version.rb +2 -2
  56. data/lib/rbcli-tool/generators.rb +1 -1
  57. data/lib/rbcli-tool/mdless_fix.rb +1 -1
  58. data/lib/rbcli-tool/project.rb +1 -1
  59. data/lib/rbcli-tool/util.rb +1 -1
  60. data/lib/rbcli-tool.rb +1 -1
  61. data/lib/rbcli.rb +5 -1
  62. data/lib-sh/lib-rbcli.sh +18 -9
  63. data/rbcli.gemspec +5 -2
  64. data/skeletons/project/application/commands/command.erb +1 -1
  65. data/skeletons/project/application/commands/script.erb +11 -7
  66. data/skeletons/project/application/options.rb +0 -5
  67. data/skeletons/project/config/general.rb +17 -0
  68. metadata +35 -3
data/docs/sitemap.xml CHANGED
@@ -2,92 +2,97 @@
2
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  <url>
4
4
  <loc>/</loc>
5
- <lastmod>2018-08-05</lastmod>
5
+ <lastmod>2018-08-08</lastmod>
6
6
  <changefreq>daily</changefreq>
7
7
  </url>
8
8
  <url>
9
9
  <loc>/imported/quick_reference/</loc>
10
- <lastmod>2018-08-05</lastmod>
10
+ <lastmod>2018-08-08</lastmod>
11
11
  <changefreq>daily</changefreq>
12
12
  </url>
13
13
  <url>
14
14
  <loc>/tutorial/10-getting_started/</loc>
15
- <lastmod>2018-08-05</lastmod>
15
+ <lastmod>2018-08-08</lastmod>
16
16
  <changefreq>daily</changefreq>
17
17
  </url>
18
18
  <url>
19
19
  <loc>/tutorial/20-project_layout/</loc>
20
- <lastmod>2018-08-05</lastmod>
20
+ <lastmod>2018-08-08</lastmod>
21
21
  <changefreq>daily</changefreq>
22
22
  </url>
23
23
  <url>
24
24
  <loc>/tutorial/30-your_first_command/</loc>
25
- <lastmod>2018-08-05</lastmod>
25
+ <lastmod>2018-08-08</lastmod>
26
26
  <changefreq>daily</changefreq>
27
27
  </url>
28
28
  <url>
29
29
  <loc>/tutorial/40-options_parameters_and_arguments/</loc>
30
- <lastmod>2018-08-05</lastmod>
30
+ <lastmod>2018-08-08</lastmod>
31
31
  <changefreq>daily</changefreq>
32
32
  </url>
33
33
  <url>
34
34
  <loc>/tutorial/50-publishing/</loc>
35
- <lastmod>2018-08-05</lastmod>
35
+ <lastmod>2018-08-08</lastmod>
36
36
  <changefreq>daily</changefreq>
37
37
  </url>
38
38
  <url>
39
39
  <loc>/advanced/command_types/</loc>
40
- <lastmod>2018-08-05</lastmod>
40
+ <lastmod>2018-08-08</lastmod>
41
41
  <changefreq>daily</changefreq>
42
42
  </url>
43
43
  <url>
44
44
  <loc>/advanced/user_config_files/</loc>
45
- <lastmod>2018-08-05</lastmod>
45
+ <lastmod>2018-08-08</lastmod>
46
46
  <changefreq>daily</changefreq>
47
47
  </url>
48
48
  <url>
49
49
  <loc>/advanced/hooks/</loc>
50
- <lastmod>2018-08-05</lastmod>
50
+ <lastmod>2018-08-08</lastmod>
51
51
  <changefreq>daily</changefreq>
52
52
  </url>
53
53
  <url>
54
54
  <loc>/advanced/automatic_updates/</loc>
55
- <lastmod>2018-08-05</lastmod>
55
+ <lastmod>2018-08-08</lastmod>
56
56
  <changefreq>daily</changefreq>
57
57
  </url>
58
58
  <url>
59
59
  <loc>/advanced/state_storage/</loc>
60
- <lastmod>2018-08-05</lastmod>
60
+ <lastmod>2018-08-08</lastmod>
61
61
  <changefreq>daily</changefreq>
62
62
  </url>
63
63
  <url>
64
64
  <loc>/advanced/distributed_state_locking/</loc>
65
- <lastmod>2018-08-05</lastmod>
65
+ <lastmod>2018-08-08</lastmod>
66
+ <changefreq>daily</changefreq>
67
+ </url>
68
+ <url>
69
+ <loc>/advanced/remote_execution/</loc>
70
+ <lastmod>2018-08-08</lastmod>
66
71
  <changefreq>daily</changefreq>
67
72
  </url>
68
73
  <url>
69
74
  <loc>/development/contributing/</loc>
70
- <lastmod>2018-08-05</lastmod>
75
+ <lastmod>2018-08-08</lastmod>
71
76
  <changefreq>daily</changefreq>
72
77
  </url>
73
78
  <url>
74
79
  <loc>/development/license/</loc>
75
- <lastmod>2018-08-05</lastmod>
80
+ <lastmod>2018-08-08</lastmod>
76
81
  <changefreq>daily</changefreq>
77
82
  </url>
78
83
  <url>
79
84
  <loc>/development/code_of_conduct/</loc>
80
- <lastmod>2018-08-05</lastmod>
85
+ <lastmod>2018-08-08</lastmod>
81
86
  <changefreq>daily</changefreq>
82
87
  </url>
83
88
  <url>
84
89
  <loc>/imported/changelog/</loc>
85
- <lastmod>2018-08-05</lastmod>
90
+ <lastmod>2018-08-08</lastmod>
86
91
  <changefreq>daily</changefreq>
87
92
  </url>
88
93
  <url>
89
94
  <loc>/whoami/</loc>
90
- <lastmod>2018-08-05</lastmod>
95
+ <lastmod>2018-08-08</lastmod>
91
96
  <changefreq>daily</changefreq>
92
97
  </url>
93
98
  </urlset>
@@ -549,6 +549,18 @@
549
549
  </li>
550
550
 
551
551
 
552
+
553
+
554
+
555
+
556
+
557
+ <li class="md-nav__item">
558
+ <a href="../../advanced/remote_execution/" title="Remote Execution" class="md-nav__link">
559
+ Remote Execution
560
+ </a>
561
+ </li>
562
+
563
+
552
564
  </ul>
553
565
  </nav>
554
566
  </li>
@@ -583,6 +583,18 @@
583
583
  </li>
584
584
 
585
585
 
586
+
587
+
588
+
589
+
590
+
591
+ <li class="md-nav__item">
592
+ <a href="../../advanced/remote_execution/" title="Remote Execution" class="md-nav__link">
593
+ Remote Execution
594
+ </a>
595
+ </li>
596
+
597
+
586
598
  </ul>
587
599
  </nav>
588
600
  </li>
@@ -556,6 +556,18 @@
556
556
  </li>
557
557
 
558
558
 
559
+
560
+
561
+
562
+
563
+
564
+ <li class="md-nav__item">
565
+ <a href="../../advanced/remote_execution/" title="Remote Execution" class="md-nav__link">
566
+ Remote Execution
567
+ </a>
568
+ </li>
569
+
570
+
559
571
  </ul>
560
572
  </nav>
561
573
  </li>
@@ -570,6 +570,18 @@
570
570
  </li>
571
571
 
572
572
 
573
+
574
+
575
+
576
+
577
+
578
+ <li class="md-nav__item">
579
+ <a href="../../advanced/remote_execution/" title="Remote Execution" class="md-nav__link">
580
+ Remote Execution
581
+ </a>
582
+ </li>
583
+
584
+
573
585
  </ul>
574
586
  </nav>
575
587
  </li>
@@ -563,6 +563,18 @@
563
563
  </li>
564
564
 
565
565
 
566
+
567
+
568
+
569
+
570
+
571
+ <li class="md-nav__item">
572
+ <a href="../../advanced/remote_execution/" title="Remote Execution" class="md-nav__link">
573
+ Remote Execution
574
+ </a>
575
+ </li>
576
+
577
+
566
578
  </ul>
567
579
  </nav>
568
580
  </li>
@@ -493,6 +493,18 @@
493
493
  </li>
494
494
 
495
495
 
496
+
497
+
498
+
499
+
500
+
501
+ <li class="md-nav__item">
502
+ <a href="../advanced/remote_execution/" title="Remote Execution" class="md-nav__link">
503
+ Remote Execution
504
+ </a>
505
+ </li>
506
+
507
+
496
508
  </ul>
497
509
  </nav>
498
510
  </li>
@@ -73,7 +73,7 @@ You can tell a command is a script by the line:
73
73
 
74
74
  ```ruby
75
75
  class List < Rbcli::Command
76
- extern path: :default # (Required): Do not edit this line. Do delete it if you wish to manually specify a script path and set environment variables.
76
+ script
77
77
  end
78
78
  ```
79
79
 
@@ -0,0 +1,56 @@
1
+ # Remote Execution
2
+
3
+ RBCli can be configured to execute commands on a remote machine via SSH instead of locally.
4
+
5
+ Currently, only `script` and `extern` commands are supported.
6
+
7
+ ## Configuration
8
+
9
+ To allow remote execution, go to `config/general.rb` and change the following line to `true`:
10
+
11
+ ```ruby
12
+ remote_execution permitted: false
13
+ ```
14
+
15
+ Then, for each command that you would like to enable remote execution for, add the following directive to the command class declaration:
16
+
17
+ ```ruby
18
+ remote_permitted
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Your end users can now execute a command remotely by specifying the connection string and credentials on the command line as follows:
24
+
25
+ ```bash
26
+ mytool --remote-exec [user@]host[:port] --identity (/path/to/private/ssh/key or password) <command>
27
+ # or
28
+ mytool -r [user@]host[:port] -i (/path/to/private/ssh/key or password) <command>
29
+ ```
30
+
31
+ Some valid examples are:
32
+
33
+ ```bash
34
+ mytool -r example.com -i myPassword showuserfiles -u MyUser
35
+ mytool -r root@server.local -i ~/.ssh/id_rsa update
36
+ mytool -r admin@172.16.0.1:2202 -i ~/.ssh/mykey cleartemp
37
+ ```
38
+
39
+ If the end user is unsure of which commands can or can not be executed remotely, they can check by running `mytool -h`. Commands that have remote execution enabled will have an asterisk (*) by their name:
40
+
41
+ ```bash
42
+ $ mytool -h
43
+ A simple command line tool.
44
+ For more information on individual commands, run `mytool <command> -h`.
45
+
46
+ Usage:
47
+ foo [options] command [parameters]
48
+
49
+ Commands:
50
+ bar TODO: Description goes here
51
+ * baz TODO: Description goes here
52
+
53
+ ...
54
+ ```
55
+
56
+ In this example, the command `baz` is available for remote execution
@@ -45,5 +45,5 @@ To release a new version, follow theese steps:
45
45
  1. Update the version number in `version.rb`
46
46
  2. Run `bundle exec rake install`, which will update `gemfile.lock` with the correct version and all dependency changes
47
47
  3. Run `docs-src/makesite.sh`, which re-compiles the documentation and pulls in the changelog and quick reference automatically
48
- 4. Commit the above changes to master, but do not push
48
+ 4. Commit the above changes to master with a commit message of "vX.X.X" (where X.X.X is the version number), but do not push
49
49
  5. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -1,9 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1 (Aug 8, 2018)
4
+
5
+ ### Features
6
+
7
+ * Remote Execution added for Script and External commands
8
+
9
+ ### Bugfixes
10
+
11
+ * Fixed a bug that caused RBCli to crash if a direct path mode script's environment variables were declared as symbols
12
+
13
+
3
14
  ## 0.2.0 (Aug 5, 2018)
4
15
 
5
16
  ### Features
6
17
 
18
+ * CLI tool Autoupdate Enabled; when an upgrade to RBCli is detected, the RBCli CLI tool will notify the developer.
7
19
  * Official documentation created and hosted with Github Pages
8
20
  * RBCli released under GPLv3
9
21
  * Copyright/License notice displayed via RBCli tool with `rbcli license` in accordance with GPLv3 guidelines
@@ -17,7 +29,6 @@
17
29
  ### Improvements
18
30
 
19
31
  * A quick reference guide can now be found in README.md
20
- * CLI tool Autoupdate Enabled; when an upgrade to RBCli is detected, the RBCli CLI tool will notify the developer.
21
32
  * Autoupdate feature now allows supplying a custom message
22
33
  * Direct Path Mode for External Commands now
23
34
  * Added support for a `lib` folder in projects, as a place for custom code, which is automatically added to `$LOAD_PATH` for developers
@@ -132,13 +132,34 @@ RBCli can automatically notify users when an update is available. Two sources ar
132
132
  You can configure automatic updates in `config/autoupdate.rb` in your project.
133
133
 
134
134
 
135
+ ## Remote Execution
136
+
137
+ RBCli can automatically execute script and extern commands on remote machines via SSH. Enable this feature in `config/general.rb` by changing the following line to `true`:
138
+
139
+ ```ruby
140
+ remote_execution permitted: false
141
+ ```
142
+
143
+ Then for each command you want to enable remote execution for, add the following directive:
144
+
145
+ ```ruby
146
+ remote_permitted
147
+ ```
148
+
149
+ Users can then execute commands remotly by specifying the connection string and credentials on the command line:
150
+
151
+ ```bash
152
+ mytool --remote-exec [user@]host[:port] --identity (/path/to/private/ssh/key or password) <command> ...
153
+ ```
154
+
155
+
135
156
  ## Development and Contributing
136
157
 
137
158
  For more information about development and contributing, please see the [Official Development Documentation][documentation_development]
138
159
 
139
160
  ## License
140
161
 
141
- The gem is available as open source under the terms of the [GPLv3](https://github.com/akhoury6/rbcli/blob/master/CODE_OF_CONDUCT.md).
162
+ The gem is available as open source under the terms of the [GPLv3][license_text].
142
163
 
143
164
  ## Full Documentation
144
165
 
@@ -148,3 +169,4 @@ The gem is available as open source under the terms of the [GPLv3](https://githu
148
169
  [documentation_home]: https://akhoury6.github.com/rbcli
149
170
  [documentation_development]: https://akhoury6.github.com/rbcli/development/contributing/
150
171
  [license_text]: https://github.com/akhoury6/rbcli/blob/master/LICENSE.txt
172
+ [changelog]: https://github.com/akhoury6/rbcli/blob/master/CHANGELOG.md
@@ -30,6 +30,8 @@ Some of its key features include:
30
30
 
31
31
  * __Project Structure and Generators__: Create a well-defined project directory structure which organizes your code and allows you to package and distribute your application as a Gem. Generators can also help speed up the process of creating new commands, scripts, and hooks!
32
32
 
33
+ * __Remote Execution__: Automatically execute commands on remote machines via SSH
34
+
33
35
 
34
36
  If you're just getting started with RBCli, take a look at the [Tutorial][tutorial]. Or take a look at the [Advanced] menu above to look through RBCli's additional featureset.
35
37
 
data/docs-src/mkdocs.yml CHANGED
@@ -21,6 +21,7 @@ pages:
21
21
  - Automatic Updates: advanced/automatic_updates.md
22
22
  - State Storage: advanced/state_storage.md
23
23
  - Distributed State Locking: advanced/distributed_state_locking.md
24
+ - Remote Execution: advanced/remote_execution.md
24
25
  - Development:
25
26
  - Contribution Guide: development/contributing.md
26
27
  - License Info: development/license.md
data/exe/rbcli CHANGED
@@ -16,7 +16,7 @@
16
16
  # You should have received a copy of the GNU General Public License #
17
17
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
18
18
  # #
19
- # For questions regarding licensing, please contact andrew@blacknex.us #
19
+ # For questions regarding licensing, please contact andrew@blacknex.us #
20
20
  ##################################################################################
21
21
 
22
22
  require "#{File.dirname(__FILE__)}/../lib/rbcli.rb"
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
  module Rbcli::Configurate
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
  require 'net/http'
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
  require 'octokit'
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
  ####
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
 
@@ -32,7 +32,8 @@ module Rbcli::Configurate
32
32
  pre_hook: nil,
33
33
  post_hook: nil,
34
34
  first_run: nil,
35
- halt_after_first_run: false
35
+ halt_after_first_run: false,
36
+ remote_execution: false
36
37
  }
37
38
 
38
39
  def self.me &block
@@ -113,6 +114,10 @@ module Rbcli::Configurate
113
114
  @data[:first_run] = block
114
115
  end
115
116
 
117
+ def self.remote_execution permitted: true
118
+ @data[:remote_execution] = permitted
119
+ end
120
+
116
121
  ##
117
122
  # Data Retrieval
118
123
  ##
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
 
@@ -72,6 +72,14 @@ class Rbcli::Command
72
72
  Rbcli::Config::add_default *params
73
73
  end
74
74
 
75
+ def self.remote_permitted
76
+ @remote_permitted = true
77
+ end
78
+
79
+ def remote_permitted?
80
+ self.class.instance_variable_get :@remote_permitted
81
+ end
82
+
75
83
  ##
76
84
  # END Interface Functions
77
85
  ##
@@ -85,8 +93,16 @@ class Rbcli::Command
85
93
  global_opts = cliopts
86
94
  config = Rbcli::config
87
95
 
88
- raise Exception.new("Command #{cmd} has both an extern and action defined. Usage is limiated to one at a time.") if @commands[cmd].extern and @commands[cmd].action
96
+ raise Exception.new("Command #{cmd} can only have one of `action`, `script`, or `extern` defined.") if (@commands[cmd].extern or @commands[cmd].script) and @commands[cmd].action
97
+
98
+ if cliopts[:remote_exec]
99
+ Rbcli::RemoteExec.new(@commands[cmd], cliopts[:remote_exec], cliopts[:identity], params, args, global_opts, config).run
100
+ #remote_exec @commands[cmd], params, args, global_opts, config
101
+ return
102
+ end
103
+
89
104
  @commands[cmd].extern.execute params, args, global_opts, config unless @commands[cmd].extern.nil?
105
+ @commands[cmd].script.execute params, args, global_opts, config unless @commands[cmd].script.nil?
90
106
  @commands[cmd].action.call params, args, global_opts, config unless @commands[cmd].action.nil?
91
107
  end
92
108
 
@@ -97,7 +113,13 @@ class Rbcli::Command
97
113
  #descmap = @commands.map { |name, klass| [name, klass.description] }.to_h
98
114
  @commands.map do |name, cmdobj|
99
115
  desc = ''
100
- indent_size.times { desc << ' ' }
116
+ if Rbcli.configuration[:remote_execution] and cmdobj.remote_permitted?
117
+ indent_size -= 3
118
+ indent_size.times { desc << ' ' }
119
+ desc << '* '
120
+ else
121
+ indent_size.times { desc << ' ' }
122
+ end
101
123
  desc << name.ljust(justification)
102
124
  desc << cmdobj.description
103
125
  end.join("\n")
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
 
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21
 
@@ -48,7 +48,11 @@ Commands:
48
48
  opts[:permitted] = nil unless opts.key? :permitted
49
49
  opt name.to_sym, opts[:description], type: opts[:type], default: opts[:default], required: opts[:required], permitted: opts[:permitted], short: opts[:short]
50
50
  end
51
- opt :json_output, 'Output result in machine-friendly JSON format', type: :boolean, default: false if data[:allow_json]
51
+ if data[:remote_execution]
52
+ opt :remote_exec, 'Remote user@host:port to execute command on', type: :string, default: nil
53
+ opt :identity, 'Identity for remote execution', type: :string, default: nil
54
+ end
55
+ opt :json_output, 'Output result in machine-friendly JSON format', short: :none, type: :boolean, default: false if data[:allow_json]
52
56
  opt :config_file, 'Specify a config file manually', short: :none, type: :string, default: data[:config_userfile] unless data[:config_userfile].nil?
53
57
  opt :generate_config, 'Generate a new config file', short: :none unless data[:config_userfile].nil? #defaults to false
54
58
  stop_on Rbcli::Command.commands.keys
@@ -67,6 +71,10 @@ Commands:
67
71
  elsif Rbcli::Command.commands.key? @cmd[0]
68
72
  @cmd << Rbcli::Command.commands[@cmd[0]].parseopts
69
73
 
74
+ if (@cliopts[:remote_exec_given] and not @cliopts[:identity_given]) or (not @cliopts[:remote_exec_given] and @cliopts[:identity_given])
75
+ Trollop::die 'Must use `--remote-exec` and `--identity` together.'
76
+ end
77
+
70
78
  Rbcli.configuration[:pre_hook].call @cliopts unless Rbcli.configuration[:pre_hook].nil?
71
79
  Rbcli::Command.runcmd(@cmd.shift, @cmd[0], @cliopts)
72
80
  Rbcli.configuration[:post_hook].call @cliopts unless Rbcli.configuration[:post_hook].nil?
@@ -15,7 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License #
16
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>. #
17
17
  # #
18
- # For questions regarding licensing, please contact andrew@blacknex.us #
18
+ # For questions regarding licensing, please contact andrew@blacknex.us #
19
19
  ##################################################################################
20
20
 
21
21