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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d33cb99755097e7f69ff49226238d5c488c61d70
4
- data.tar.gz: a35ff75d0e23174c3f5968b8115ac957ae687d0f
3
+ metadata.gz: 8986b30d5ff457c34632c6090c833f0228a273e5
4
+ data.tar.gz: 68ac8e7964bcc6c24026d614afe078e42124a458
5
5
  SHA512:
6
- metadata.gz: e1f67ad380e9b3869542722a7c33ab5ab6c0e6129cddd154b3be14b26087e6c094d71167b23df7bb5bb150b000f873e0d8e500204b804bc456a3c9cb3c7cb05c
7
- data.tar.gz: 6ea6f508801838b752e8455b26d18fb1b83f88c846539a4d12eec27f584beae4f335c68197df5e88402593e48278eed3540966b2996d6e1befb18c77fc37635d
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
- if file.nil?
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: 'clito',
8
+ register name: 'clitopic',
9
9
  description: 'clitopic commands',
10
- hidden: true
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: 'clito'
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: 'clito'
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
- raise ArgumentError.new("Missing file")
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: 'clito'
113
+ topic: 'clitopic'
110
114
 
111
115
  class << self
112
116
  def call
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Clitopic
2
- VERSION = '0.9.8'
2
+ VERSION = '0.9.9'
3
3
  end
@@ -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 = ["clito:"]
7
- response = ["clito:defaults_file", "clito:suggestions", "clito:version"].join("\n") + "\n"
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.8
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: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec