cli-topic 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clitopic/command/base.rb +1 -9
- data/lib/clitopic/command/clito.rb +11 -7
- data/lib/clitopic/helpers.rb +10 -0
- data/lib/clitopic/version.rb +1 -1
- data/spec/command/clito_suggestions_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8986b30d5ff457c34632c6090c833f0228a273e5
|
4
|
+
data.tar.gz: 68ac8e7964bcc6c24026d614afe078e42124a458
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3b6cc8cc6565da5f9f31ce70ea2bba33753e3df607178146e1fa4e6c8f94c843c2feba589266bdaea1132699b3ab99efe214a737d4779fba769496616bc9b0
|
7
|
+
data.tar.gz: fb092adc4defb68231ea68cebabafac9cb0206e3010d55b921ef2fe8a4a408f223c474c78150fa9fda656d2e817dd7c3872b4f0c6b93681cd75ff7be3a30ecfd
|
@@ -81,15 +81,7 @@ module Clitopic
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def load_defaults(file=nil)
|
84
|
-
|
85
|
-
Clitopic.default_files.each do |f|
|
86
|
-
if File.exist?(f)
|
87
|
-
file = f
|
88
|
-
break
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
84
|
+
file ||= Clitopic::Helpers.find_default_file
|
93
85
|
if file.nil?
|
94
86
|
return
|
95
87
|
end
|
@@ -5,16 +5,16 @@ require 'clitopic/helpers'
|
|
5
5
|
module Clitopic
|
6
6
|
module Command
|
7
7
|
class ClitoTopic < Clitopic::Topic::Base
|
8
|
-
register name: '
|
8
|
+
register name: 'clitopic',
|
9
9
|
description: 'clitopic commands',
|
10
|
-
hidden:
|
10
|
+
hidden: false
|
11
11
|
end
|
12
12
|
|
13
13
|
class Suggestions < Clitopic::Command::Base
|
14
14
|
register name: 'suggestions',
|
15
15
|
description: 'suggests available commands base on incomplete input',
|
16
16
|
hidden: true,
|
17
|
-
topic: '
|
17
|
+
topic: 'clitopic'
|
18
18
|
|
19
19
|
def self.call
|
20
20
|
puts Clitopic::Helpers.suggestion(@arguments[0], Clitopic::Commands.all_commands)
|
@@ -26,7 +26,7 @@ module Clitopic
|
|
26
26
|
register name: 'defaults_file',
|
27
27
|
description: "create default file",
|
28
28
|
hidden: true,
|
29
|
-
topic: '
|
29
|
+
topic: 'clitopic'
|
30
30
|
|
31
31
|
option :merge, "--[no-]merge", "Merge options with current file", default: true
|
32
32
|
option :force, "-f", "--force", "Overwrite file", default: false
|
@@ -91,9 +91,13 @@ module Clitopic
|
|
91
91
|
def call
|
92
92
|
puts @options
|
93
93
|
if @arguments.size == 0
|
94
|
-
|
94
|
+
file = Clitopic::Helpers.find_default_file
|
95
|
+
if file.nil?
|
96
|
+
raise ArgumentError.new("Missing file")
|
97
|
+
end
|
98
|
+
else
|
99
|
+
file = @arguments[0]
|
95
100
|
end
|
96
|
-
file = @arguments[0]
|
97
101
|
opts = dump_options(file, @options[:merge], @options[:force])
|
98
102
|
puts opts
|
99
103
|
return opts
|
@@ -106,7 +110,7 @@ module Clitopic
|
|
106
110
|
register name: 'version',
|
107
111
|
description: "Display clitopic version",
|
108
112
|
hidden: true,
|
109
|
-
topic: '
|
113
|
+
topic: 'clitopic'
|
110
114
|
|
111
115
|
class << self
|
112
116
|
def call
|
data/lib/clitopic/helpers.rb
CHANGED
@@ -437,6 +437,16 @@ module Clitopic
|
|
437
437
|
end
|
438
438
|
end
|
439
439
|
|
440
|
+
def find_default_file
|
441
|
+
Clitopic.default_files.each do |f|
|
442
|
+
if File.exist?(f)
|
443
|
+
file = f
|
444
|
+
break
|
445
|
+
end
|
446
|
+
end
|
447
|
+
return file
|
448
|
+
end
|
449
|
+
|
440
450
|
def error_log_path
|
441
451
|
File.join(home_directory, '.clitopic', 'error.log')
|
442
452
|
end
|
data/lib/clitopic/version.rb
CHANGED
@@ -3,8 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Clitopic::Command::Suggestions do
|
4
4
|
context 'Prefix' do
|
5
5
|
it 'Call uncompleted command should display list of commands' do
|
6
|
-
Clitopic::Command::Suggestions.arguments = ["
|
7
|
-
response = ["
|
6
|
+
Clitopic::Command::Suggestions.arguments = ["clitopic:"]
|
7
|
+
response = ["clitopic:defaults_file", "clitopic:suggestions", "clitopic:version"].join("\n") + "\n"
|
8
8
|
|
9
9
|
|
10
10
|
expect{Clitopic::Command::Suggestions.call}.to output(response).to_stdout
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cli-topic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Legrand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|