runfile 0.6.3 → 0.6.4

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: 07eb84f262b49c776d311056be64345f415c94da
4
- data.tar.gz: fc740fc871111c1bac8a30df994b4ce4778c1ecf
3
+ metadata.gz: 3e1e4b811b20fb3a6a072a25ad05c6cabada1191
4
+ data.tar.gz: 225f4622994b215a2f8528608e8979efca08da0d
5
5
  SHA512:
6
- metadata.gz: 57b71aaad3c8bde5c96064abe7ab2662509903f327cbed5f8fb43caa6ffc104f5c0f437ae10f8c51ba71018c23fd5c3eb4b75dd5f05bd8c1a3f658f5fe7e4b44
7
- data.tar.gz: f04af615efa538afc2f6fefe69aa65815ab87069e4281a446694d99e57d5dc966b7cf9da094c69699bdce77f28b504216d81ad0cd2dcaa4c290fa99f37802d42
6
+ metadata.gz: 80d1173e587d084821f875e2c2ce7e2b530503d8dd01909b5516cb7adfe28acc7d8eaf379fdf0bd0409b53c09835bedc130dbdcbe0da7344ad0d584d7a4eb98f
7
+ data.tar.gz: ebac3b2ea0e53e8f7f39ac6d32c874a5617d4bb66169a4f4912d9b79ab79121b73ab6af69f0643eda467f6efcc205e83433d11581e9e731271ccf8ec63d98762
@@ -131,6 +131,16 @@ module Runfile
131
131
  say "#{settings.intro}\n" if settings.intro
132
132
  say "Usage: run <file>"
133
133
  say word_wrap(message, width)
134
+
135
+ show_shortcuts if settings.shortcuts
136
+ end
137
+
138
+ def show_shortcuts
139
+ say "\nShortcuts:"
140
+ max = settings.shortcuts.keys.max_by(&:length).length
141
+ settings.shortcuts.each_pair do |shortcut, command|
142
+ say " #{shortcut.rjust max} : #{command}"
143
+ end
134
144
  end
135
145
 
136
146
  end
@@ -32,7 +32,9 @@ module Runfile
32
32
  # Load and execute a Runfile call.
33
33
  def execute(argv, filename='Runfile')
34
34
  @ignore_settings = !filename
35
+ argv = expand_shortcuts argv
35
36
  filename and File.file?(filename) or handle_no_runfile argv
37
+
36
38
  begin
37
39
  load settings.helper if settings.helper
38
40
  load filename
@@ -147,5 +149,17 @@ module Runfile
147
149
  end
148
150
  exit
149
151
  end
152
+
153
+ def expand_shortcuts(argv)
154
+ possible_candidate = argv[0]
155
+ if settings.shortcuts and settings.shortcuts[possible_candidate]
156
+ shortcut_value = settings.shortcuts[argv[0]]
157
+ expanded = shortcut_value.split ' '
158
+ say "!txtblu!# #{possible_candidate} > #{shortcut_value}"
159
+ argv.shift
160
+ argv = expanded + argv
161
+ end
162
+ argv
163
+ end
150
164
  end
151
165
  end
@@ -1,3 +1,3 @@
1
1
  module Runfile
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-18 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole