tcollier-commando 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/commando/io_handler.rb +7 -7
- data/lib/commando/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5325137899697d0e9166e6cbe578ac16be28753e
|
4
|
+
data.tar.gz: b27473af548a18cc382444b85d20574a7b1a1e58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2068d9b73e94d36a392f7be87bcef00df62bc6d18a089ea319ac565ab06f3b7ab40b5508767457af5cd00c4c43da15605cc03764fdfc02f5e1ef3e6836bf07f1
|
7
|
+
data.tar.gz: e87b4c3b616b2342cb016bc5837489dbc54727c1be30b054a401442099e8bac64ae18825a35058ef11db6914b80c1e846e3ffcb1a20f1f48c13e3f9c0900e917
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ A command line interface builder with Readline support
|
|
8
8
|
* `0.1.1` - Alphabetize commands printed via `help`
|
9
9
|
* `0.1.2` - Remove empty lines from history
|
10
10
|
* `0.2.0` - Persist history across CLI sessions
|
11
|
+
* `0.2.1` - Fix bug when history file doesn't exist
|
11
12
|
|
12
13
|
## Installation
|
13
14
|
|
data/lib/commando/io_handler.rb
CHANGED
@@ -41,19 +41,19 @@ module Commando
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def load_history
|
44
|
-
if
|
45
|
-
File.readlines(
|
44
|
+
if history_file && File.exists?(history_file)
|
45
|
+
File.readlines(history_file).each do |line|
|
46
46
|
Readline::HISTORY.push(line.chomp)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
def save_history(line)
|
52
|
-
if
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
File.open(history_file, 'a') { |f| f.puts(line) } if history_file
|
53
|
+
end
|
54
|
+
|
55
|
+
def history_file
|
56
|
+
Commando.config.history_file
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
data/lib/commando/version.rb
CHANGED