coltrane 3.1.0 → 3.1.1

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
  SHA256:
3
- metadata.gz: 3e888d83950eea8d581348fb1ef12c40ab5577ea73e13398760c29a4957cdf9c
4
- data.tar.gz: a5441c9bdfdc66d5d12426087164e2396ad49fdbc11bd179981590174104ca43
3
+ metadata.gz: 6f3a6358298a33b8fb7ad3553bdf3bf1a580e801e7736703284e0b8d181459f1
4
+ data.tar.gz: f34fa1941faadde24b563ca891c2222726c97edf1892a55a0f87f38cd3f1ae16
5
5
  SHA512:
6
- metadata.gz: 6857cd706621735986c7ee7ca46bac9e226a6566539a93e03e9ca62c21bc6e39bd687dae45cb20845b8bbe960b9b7fc9974b8f59e5fcfdf1dc8851cd830fd7cc
7
- data.tar.gz: 0df7240e3d1876a26bb44ca0e20b1490222da343d3c6654bb67c493ce094b7d9b6be14b13e8c47d44b8c2e703dda8a8568dd22074f4d0735f48da50fdcbb114e
6
+ metadata.gz: 65b8e34027979fc2dba3a18a4f56fa9e7be2d6c1d38a143e54e557f655bdbdc020b179e2b3ceb709e39c22d6dfc42b8c11eba305f82faf3489bc6777213139c0
7
+ data.tar.gz: 4e8c6b7d113a35124ec7409b50f89528ee469413a500129ccc3868451b8ab03f5a1be43c217eacff4b096e96b824b790f77cd669886bd77fda1e7ca4046b0983
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coltrane (3.1.0)
4
+ coltrane (3.1.1)
5
5
  color (~> 1.8)
6
6
  dry-monads (~> 0.4)
7
- mercenary (~> 0.3)
8
7
  paint (~> 2.0)
8
+ pedrozath-mercenary (= 0.3.8)
9
9
  tty-reader (~> 0.2)
10
10
 
11
11
  GEM
@@ -28,7 +28,6 @@ GEM
28
28
  hike (1.2.3)
29
29
  hitimes (1.2.6)
30
30
  json (2.1.0)
31
- mercenary (0.3.6)
32
31
  method_source (0.9.0)
33
32
  necromancer (0.4.0)
34
33
  opal (0.10.5)
@@ -45,6 +44,7 @@ GEM
45
44
  pastel (0.7.2)
46
45
  equatable (~> 0.5.0)
47
46
  tty-color (~> 0.4.0)
47
+ pedrozath-mercenary (0.3.8)
48
48
  powerpack (0.1.1)
49
49
  pry (0.11.3)
50
50
  coderay (~> 1.1.0)
@@ -14,8 +14,13 @@ Class.new do
14
14
  shell
15
15
  end
16
16
 
17
- def quit_commands
18
- /quit|exit/
17
+ def quit_cmd?(cmd)
18
+ cmd =~ /quit|exit/
19
+ end
20
+
21
+ def ignored_cmd?(cmd)
22
+ cmd =~ /shell/ ||
23
+ cmd.strip == ''
19
24
  end
20
25
 
21
26
  def command
@@ -24,8 +29,9 @@ Class.new do
24
29
 
25
30
  def shell
26
31
  command
27
- .tap { |cmd| exit if cmd =~ quit_commands }
28
- .yield_self { |cmd| %x{coltrane #{cmd}}}
32
+ .tap { |cmd| exit if quit_cmd?(cmd) }
33
+ .tap { |cmd| shell and return if ignored_cmd?(cmd) }
34
+ .yield_self { |cmd| %x{coltrane #{cmd}} }
29
35
  .yield_self { |response| puts ["\n", response, "\n"].join }
30
36
  shell
31
37
  end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency 'dry-monads', '~> 0.4'
37
37
  spec.add_runtime_dependency 'paint', '~> 2.0'
38
38
  spec.add_runtime_dependency 'color', '~> 1.8'
39
- spec.add_runtime_dependency 'mercenary', '~> 0.3'
39
+ spec.add_runtime_dependency 'pedrozath-mercenary', '0.3.8'
40
40
  spec.add_development_dependency "bundler", '~> 1.14'
41
41
  spec.add_development_dependency "rake", '~> 10.0'
42
42
  end
@@ -2,10 +2,13 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
5
+ require 'bundler'
6
+ Bundler.require(:default)
5
7
 
6
8
  require 'paint'
7
9
  require 'color'
8
- require 'mercenary'
10
+
11
+ require 'pedrozath-mercenary'
9
12
  require 'coltrane/commands'
10
13
 
11
14
  Paint.mode = 0xFFFFFF
@@ -36,6 +39,22 @@ Mercenary.program(:Coltrane) do |p|
36
39
  end
37
40
  end
38
41
 
42
+ p.command(:help) do |c|
43
+ c.description 'May give you some help.'
44
+ c.syntax 'help <command> [subcommand, sub-subcommand, ...]'
45
+ c.action do |(*command_path), _options|
46
+ if command_path.empty?
47
+ puts p
48
+ else
49
+ puts begin
50
+ command_path.reduce(p) do |memo, key|
51
+ memo.commands.delete(key.to_sym)
52
+ end || "\n Sorry, command found."
53
+ end
54
+ end
55
+ end
56
+ end
57
+
39
58
  p.default_command(:shell)
40
59
  end
41
60
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coltrane
4
- VERSION = '3.1.0'
4
+ VERSION = '3.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coltrane
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Maciel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-04 00:00:00.000000000 Z
11
+ date: 2018-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-reader
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.8'
69
69
  - !ruby/object:Gem::Dependency
70
- name: mercenary
70
+ name: pedrozath-mercenary
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '0.3'
75
+ version: 0.3.8
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '0.3'
82
+ version: 0.3.8
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement