simple-cli 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7533ba5ce80d0d6f173f3bc5cc071ff22590977
4
- data.tar.gz: 2e416315dbb0addf9eedaa7e84fc0cebaf17dfbc
3
+ metadata.gz: d2bbb7f97dbbfd4da167b579db74edf64e58f696
4
+ data.tar.gz: 3fa71c9effb4830a2542d11562767c67da9f2f95
5
5
  SHA512:
6
- metadata.gz: 552c4c85dd75a898b035b53bfc67d2d74b3e1f37569099d7fb6ec88e61827272d23f28a0252bf30bf674d817b64040f1c25e3606baf31860a2ae0c73eb2e6768
7
- data.tar.gz: b58f646e7a7aefe93c66731d228e2f14dfe2266112da195041e0f13f580c4d22b9ce280a3b8eb0dc3809306d97151e69ac7fe5065bf3774bdaa5c51bd948cc08
6
+ metadata.gz: dbf7773b19c487d395706b84b9ea35d59ff9fd11b63b2adf2624375d0212d9ceec8ea55b154f68be4e71fb16ec06f9d177ad178f15a34b464298c5908e1ab0b7
7
+ data.tar.gz: f6ee3a7d40c9dd6eb3849625294b17c2cbe5f096b5d7c78a34b0292a67af436fefb12e60b6997acddd3c0f9d36d66d4218064690413ac8495acd9bb0c5511497
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple-cli (0.2.2)
4
+ simple-cli (0.2.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -18,6 +18,17 @@ module Simple::CLI::Helpers
18
18
  ::Simple::CLI.logger
19
19
  end
20
20
 
21
+ SSH = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
22
+
23
+ def ssh_command(host, user: nil)
24
+ host = "#{user}@#{host}" if user
25
+ "#{SSH} #{host}"
26
+ end
27
+
28
+ def ssh!(target, command, user: nil)
29
+ sys! "#{ssh_command(target, user: user)} #{command}"
30
+ end
31
+
21
32
  def sh!(cmd, *args)
22
33
  command = Command.new(cmd, *args)
23
34
  result = command.sh
@@ -144,6 +144,7 @@ class Simple::CLI::Runner
144
144
  command_help = command_helps.fetch(sym)
145
145
  command_help = format("%-#{max_command_helps_length}s", command_help)
146
146
  edoc = CommandHelp.new(@app, sym)
147
+ next if !edoc.head && logger.level != ::Logger::DEBUG
147
148
  head = "# #{edoc.head}" if edoc.head
148
149
  STDERR.puts " #{command_help} #{head}"
149
150
  end
@@ -153,10 +154,11 @@ class Simple::CLI::Runner
153
154
  STDERR.puts <<~DOC
154
155
  Default options include:
155
156
 
156
- #{binary_name} [ --verbose | -v ] # run on DEBUG log level
157
- #{binary_name} [ --quiet | -q ] # run on WARN log level
158
- #{binary_name} help [ subcommand ] # print help on a specific subcommand
159
- #{binary_name} help autocomplete # print information on autocompletion.
157
+ #{binary_name} [ --verbose | -v ] # run on DEBUG log level
158
+ #{binary_name} [ --quiet | -q ] # run on WARN log level
159
+ #{binary_name} help [ subcommand ] # print help on a specific subcommand
160
+ #{binary_name} help autocomplete # print information on autocompletion.
161
+ #{binary_name} help -v # show help for internal commands as well
160
162
 
161
163
  DOC
162
164
 
@@ -30,12 +30,16 @@ module Simple::CLI::Runner::Autocompletion
30
30
  end
31
31
  end
32
32
 
33
+ DEFAULT_OPTIONS = %w(--verbose -v --quiet -q)
34
+
33
35
  def autocomplete_subcommand_options(subcommand, cur)
34
36
  if subcommand == "help"
35
37
  completions = commands.map(&:to_s).map { |s| s.tr("_", ":") } + ["autocomplete"]
36
38
  filter_completions completions, prefix: cur
37
- elsif cur[0,1] == "-"
39
+ elsif cur && cur[0,1] == "-"
38
40
  completions = CommandHelp.option_names(@app, string_to_command(subcommand))
41
+ completions += DEFAULT_OPTIONS
42
+
39
43
  filter_completions completions, prefix: cur
40
44
  else
41
45
  Dir.glob "#{cur}*"
@@ -1,5 +1,5 @@
1
1
  module Simple
2
2
  module CLI
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-17 00:00:00.000000000 Z
12
+ date: 2018-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake