zimilar 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -7
- data/lib/zimilar/version.rb +1 -1
- data/zimilar.gemspec +3 -3
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 165a018850d56fe4f4d59d5a732d97dbeee9448a
|
4
|
+
data.tar.gz: 06dd3e6e63eda292ee984ba732119538da0b4498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5ac5c88a57b1e5a8e8dae41824ccadd9be647449ef947c4736beb2c0d9b6f46ad9e3e591b04c0ee8b50dd8a4d9aa04fd7a86b9eab6dd22d06d6830a4c5c5c85
|
7
|
+
data.tar.gz: 1440a20ca6c4c9659e2469962fdd4423249d74d68e0b4d620788c7ba08851173e08837aaad96b0f4e7142a12ae4b5fc6e4d5d2ba165456548fad8b1ae0fc72ed
|
data/README.md
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
# Zimilar
|
2
2
|
|
3
|
-
This small gem extends your
|
4
|
-
|
5
|
-
There is no reason why this should only work with zsh, but I haven't tested it with other shells yet and there is currently no logic in ```zimilar``` that tries to find out your current running shell.
|
3
|
+
This small gem extends your shell (see ```Supported Shells```) to autocorrect inputs that would led in a 'command not found'. It basically parses your history file and tries to match to most suitable command found.
|
6
4
|
|
7
5
|
```zimilar``` is just a small late-night hack I did and might be improved in the future. Its code is currently also not that optimized but for now, it works.
|
8
6
|
|
9
7
|
I also think that it might be better to write this as a native shell function in order to not require ruby to be installed. As times pass by, this might change.
|
10
8
|
|
9
|
+
|
10
|
+
## Supported Shells
|
11
|
+
|
12
|
+
The following shells are supported by now:
|
13
|
+
|
14
|
+
- [zsh](http://www.zsh.org/)
|
15
|
+
- [bash](https://www.gnu.org/software/bash/bash.html)
|
16
|
+
|
11
17
|
## Installation
|
12
18
|
|
13
19
|
Install it yourself as:
|
@@ -21,27 +27,53 @@ Install from source:
|
|
21
27
|
$ rake build
|
22
28
|
$ gem install pkg/zimilar-VERSION.gem
|
23
29
|
|
24
|
-
Or simply copy the bin/zimilar to anywhere you want. Please ensure to install its dependencies.
|
30
|
+
Or simply copy the ```bin/zimilar``` to anywhere you want. Please ensure to install its dependencies.
|
31
|
+
|
32
|
+
|
33
|
+
## How it Works
|
34
|
+
|
35
|
+
```zimilar``` parses your history file and compares the given command with all commands found in the history. It's using the [similar_text](https://github.com/seph/ruby-similar-text) gem to evaluate the matches.
|
36
|
+
|
37
|
+
If ```zimilar``` finds a suitable match, it replaces your command and runs it.
|
25
38
|
|
26
39
|
## Usage
|
27
40
|
|
41
|
+
Please be aware of that this is a nightly hack and might, under worst circumstances, destroy all you know and love. Please do not use it without having this read.
|
42
|
+
|
43
|
+
```zimilar``` doesn't correct to commands with a length less or equal than 2. This is because of most 'dangerous' commands are 2 charackters long, e.g. ```cp```, ```mv```, ```rm``` and many others.
|
44
|
+
|
45
|
+
But still, use it at your own risk.
|
46
|
+
|
47
|
+
### zsh
|
28
48
|
Add the following into your .zshrc or any other file that is being ```source```ed during your login:
|
29
49
|
|
30
|
-
```
|
50
|
+
```bash
|
31
51
|
function command_not_found_handler() {
|
32
52
|
zimilar $@
|
33
53
|
}
|
34
54
|
```
|
35
55
|
|
36
|
-
|
56
|
+
### bash
|
57
|
+
Add the following into your .bashrc or any other file that is being ```source```ed during your login:
|
58
|
+
|
59
|
+
```bash
|
60
|
+
function command_not_found_handle {
|
61
|
+
zimilar $@
|
62
|
+
}
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
## Example
|
37
67
|
```
|
38
68
|
kl@kbook:~/ $ vm
|
39
69
|
Auto-guessed 'vim', 60.0%
|
40
70
|
kl@kbook:~/ $
|
71
|
+
|
41
72
|
```
|
73
|
+
|
42
74
|
## Contributing
|
43
75
|
|
44
|
-
1. Fork it ( http://github.com
|
76
|
+
1. Fork it ( http://github.com/lotherk/zimilar/fork )
|
45
77
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
78
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
47
79
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/zimilar/version.rb
CHANGED
data/zimilar.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Zimilar::VERSION
|
9
9
|
spec.authors = ["Konrad Lother"]
|
10
10
|
spec.email = ["konrad@corpex.de"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
13
|
-
spec.homepage = ""
|
11
|
+
spec.summary = %q{This small gem extends your shell to autocorrect inputs that would led in a 'command not found'.}
|
12
|
+
spec.description = %q{This small gem extends your shell to autocorrect inputs that would led in a 'command not found'.}
|
13
|
+
spec.homepage = "https://github.com/lotherk/zimilar"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zimilar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konrad Lother
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,8 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description: This small gem extends your shell to autocorrect inputs that would led
|
42
|
+
in a 'command not found'.
|
42
43
|
email:
|
43
44
|
- konrad@corpex.de
|
44
45
|
executables:
|
@@ -55,7 +56,7 @@ files:
|
|
55
56
|
- lib/zimilar.rb
|
56
57
|
- lib/zimilar/version.rb
|
57
58
|
- zimilar.gemspec
|
58
|
-
homepage:
|
59
|
+
homepage: https://github.com/lotherk/zimilar
|
59
60
|
licenses:
|
60
61
|
- MIT
|
61
62
|
metadata: {}
|
@@ -78,5 +79,6 @@ rubyforge_project:
|
|
78
79
|
rubygems_version: 2.1.10
|
79
80
|
signing_key:
|
80
81
|
specification_version: 4
|
81
|
-
summary:
|
82
|
+
summary: This small gem extends your shell to autocorrect inputs that would led in
|
83
|
+
a 'command not found'.
|
82
84
|
test_files: []
|