huffshell 0.0.4 → 0.0.5
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.
- data/Gemfile.lock +1 -1
- data/Readme.md +2 -8
- data/bin/huffshell +6 -1
- data/lib/readers/oh_my_zsh_reader.rb +13 -4
- metadata +50 -30
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -21,12 +21,6 @@ Features
|
|
21
21
|
Installation
|
22
22
|
---------------------
|
23
23
|
|
24
|
-
You need to have zsh_history stored at this location: '~/.zsh_history'. If this code outputs a lot of junk, you are probably setup.
|
25
|
-
|
26
|
-
```script
|
27
|
-
cat ~/.zsh_history
|
28
|
-
```
|
29
|
-
|
30
24
|
Here is how you install the gem.
|
31
25
|
|
32
26
|
```script
|
@@ -48,10 +42,10 @@ Update
|
|
48
42
|
gem update huffshell
|
49
43
|
````
|
50
44
|
|
51
|
-
|
45
|
+
De-duplication
|
52
46
|
---------------------
|
53
47
|
|
54
|
-
|
48
|
+
Many people have some form of deduplication on their ZSH history. That is a gret feature but will prevent you from getting all of the benifits of alias generation. If you are curious and want to see a better picture of your shell usage, here is a zsh configuration which remove deduping and creates a more accurate picture.
|
55
49
|
|
56
50
|
```script
|
57
51
|
## Command history configuration
|
data/bin/huffshell
CHANGED
@@ -5,10 +5,15 @@ require 'colorize'
|
|
5
5
|
|
6
6
|
cs = CommandSuggestor.new
|
7
7
|
|
8
|
+
# TODOS
|
9
|
+
# get largest history file
|
10
|
+
# examine to see what format the file is in
|
11
|
+
# let users tell me where their files is
|
12
|
+
|
8
13
|
files = ['~/.zsh_history', '~/.zshhistory', '~/.zhistory']
|
9
14
|
history_filename = files.map{|f| File.expand_path(f) }.select{|f| File.exist?(f) }.first
|
10
15
|
|
11
|
-
puts "
|
16
|
+
puts "Huffshell"
|
12
17
|
puts "============="
|
13
18
|
puts ["History found:", history_filename, File.size(history_filename).to_s].join(" ")
|
14
19
|
|
@@ -5,13 +5,22 @@ class OhMyZshReader
|
|
5
5
|
|
6
6
|
def initialize(file_name)
|
7
7
|
@file_name = file_name
|
8
|
-
|
8
|
+
|
9
|
+
file = File.open(File.expand_path(file_name), 'r')
|
10
|
+
|
11
|
+
@file_contents = ""
|
9
12
|
|
10
13
|
if String.method_defined?(:encode)
|
11
|
-
@file_contents.encode!('UTF-8', 'UTF-8', :invalid => :replace)
|
14
|
+
@file_contents = file.read.encode!('UTF-8', 'UTF-8', :invalid => :replace)
|
12
15
|
else
|
13
|
-
ic = Iconv.new('UTF-8', 'UTF-8
|
14
|
-
|
16
|
+
ic = Iconv.new('UTF-8', 'UTF-8')
|
17
|
+
file.each do |l|
|
18
|
+
begin
|
19
|
+
@file_contents += ic.iconv(l)
|
20
|
+
rescue
|
21
|
+
puts "Encoding error: #{l}"
|
22
|
+
end
|
23
|
+
end
|
15
24
|
end
|
16
25
|
end
|
17
26
|
|
metadata
CHANGED
@@ -1,35 +1,45 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: huffshell
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Paul McKellar
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-06-18 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: colorize
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
22
32
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
description: A parser and recommendation system for your shell aliases based on your
|
26
|
-
shell history
|
33
|
+
version_requirements: *id001
|
34
|
+
description: A parser and recommendation system for your shell aliases based on your shell history
|
27
35
|
email: paul.mckellar@gmail.com
|
28
|
-
executables:
|
36
|
+
executables:
|
29
37
|
- huffshell
|
30
38
|
extensions: []
|
39
|
+
|
31
40
|
extra_rdoc_files: []
|
32
|
-
|
41
|
+
|
42
|
+
files:
|
33
43
|
- lib/command/command_suggestion.rb
|
34
44
|
- lib/command/command_suggestor.rb
|
35
45
|
- lib/command/command_word.rb
|
@@ -48,26 +58,36 @@ files:
|
|
48
58
|
- Readme.md
|
49
59
|
homepage: https://github.com/paulmars/huffshell
|
50
60
|
licenses: []
|
61
|
+
|
51
62
|
post_install_message:
|
52
63
|
rdoc_options: []
|
53
|
-
|
64
|
+
|
65
|
+
require_paths:
|
54
66
|
- lib
|
55
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
68
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
77
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
67
85
|
requirements: []
|
86
|
+
|
68
87
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.8.
|
88
|
+
rubygems_version: 1.8.17
|
70
89
|
signing_key:
|
71
90
|
specification_version: 3
|
72
91
|
summary: Automatic shell alias recommondations based on usage!
|
73
92
|
test_files: []
|
93
|
+
|