command-line-favs 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +17 -2
- data/bin/fav +1 -1
- data/features/command-line-favs.feature +2 -2
- data/lib/fav.rb +7 -6
- data/lib/fav/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: ce071cfe235b3f7415d36942c89eb1db8d7f05bb
|
4
|
+
data.tar.gz: 6c744e9d6d5c220bfb6f8719d2c21a8be54997f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a5166ff8fce264ba7b6bc8d8589c90ab348864290442e01ab8e9c26f4ed03f933a8310e92e393654da499b7c2f8d94ac7e4dd7ec9f5727ae66bbf5be8f21951
|
7
|
+
data.tar.gz: 9323b433d668d6f618be33e45115c2586cf8d6befff98b35fcb23d48d6a5def1ef6c2f1438bac993217de488d0d9f4537e9979a3c8e9a919af7c3407fa117e50
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,16 @@ Command Line Favs is a CLI utility for organizing your commonly used shell comma
|
|
4
4
|
|
5
5
|
A *~/.favs* file might look something like:
|
6
6
|
|
7
|
+
# Installation
|
8
|
+
|
9
|
+
Command Line Favs is packaged a ruby gem. To install run:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem install command-line-favs
|
13
|
+
```
|
14
|
+
|
15
|
+
# Documentation
|
16
|
+
|
7
17
|
```
|
8
18
|
#comments are supported so are un-grouped commands like this one
|
9
19
|
#positional-based substitution is also suported
|
@@ -77,13 +87,13 @@ You can also always manually remove a *Fav* by modifying your *~/.favs* file.
|
|
77
87
|
List favs within a group:
|
78
88
|
|
79
89
|
```
|
80
|
-
fav -
|
90
|
+
fav -l -g ssh
|
81
91
|
```
|
82
92
|
|
83
93
|
List all commands:
|
84
94
|
|
85
95
|
```
|
86
|
-
fav -
|
96
|
+
fav -l -g
|
87
97
|
```
|
88
98
|
## Run a Fav
|
89
99
|
|
@@ -106,3 +116,8 @@ $ fav -g TestGroup --no_prompt
|
|
106
116
|
```
|
107
117
|
|
108
118
|
When running an entire group of commands the default behavior is to prompt on each command. This can be overridden by supplying the *--no_prompt* flag.
|
119
|
+
|
120
|
+
## Future enhancements
|
121
|
+
|
122
|
+
* Tab completion for groups and commands
|
123
|
+
* Support the running of bash/zsh built-in commmands
|
data/bin/fav
CHANGED
@@ -18,7 +18,7 @@ class App
|
|
18
18
|
|
19
19
|
#Define flags
|
20
20
|
on("-a COMMAND_TEXT","--add", "Add a command to the list of favorites")
|
21
|
-
on("-
|
21
|
+
on("-l", "--list", "List available commands")
|
22
22
|
on("-g GROUP_NAME","--group", "If used with -a flag, will add command to group. Otherwise will run command within group")
|
23
23
|
on("-r","--remove", "Remove a command from the list of favorites")
|
24
24
|
#
|
@@ -111,7 +111,7 @@ Feature: Run and save commands
|
|
111
111
|
ef = "echo Foo"
|
112
112
|
eb = "echo Bar"
|
113
113
|
"""
|
114
|
-
When I run `fav -
|
114
|
+
When I run `fav -l -g test`
|
115
115
|
Then it should pass with exactly:
|
116
116
|
"""
|
117
117
|
ef = "echo Foo"
|
@@ -127,7 +127,7 @@ Feature: Run and save commands
|
|
127
127
|
ef = "echo Foo"
|
128
128
|
eb = "echo Bar"
|
129
129
|
"""
|
130
|
-
When I run `fav -
|
130
|
+
When I run `fav -l`
|
131
131
|
Then it should pass with exactly:
|
132
132
|
"""
|
133
133
|
ug = "echo ungrouped"
|
data/lib/fav.rb
CHANGED
@@ -86,10 +86,10 @@ module Fav
|
|
86
86
|
when 'Y', 'C'
|
87
87
|
sh value
|
88
88
|
when 'B'
|
89
|
-
|
89
|
+
info 'Breaking the execution of all remaining commands in group.'
|
90
90
|
break
|
91
91
|
else #'N' or some unrecognized option
|
92
|
-
|
92
|
+
info "Skipping the execution of #{value}"
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -97,6 +97,7 @@ module Fav
|
|
97
97
|
|
98
98
|
# Run non-grouped command
|
99
99
|
def on_non_group
|
100
|
+
CommandFactory.command_name_check(self.command_name, 'Running')
|
100
101
|
run_cmd self.config[self.command_name]
|
101
102
|
end
|
102
103
|
|
@@ -150,13 +151,13 @@ module Fav
|
|
150
151
|
# Add a grouped fav
|
151
152
|
def on_group(group)
|
152
153
|
self.config.add_to_group(group, self.command_name, self.cli_options[:add])
|
153
|
-
|
154
|
+
info "Successfully added #{self.command_name} to the '#{group}' group!"
|
154
155
|
end
|
155
156
|
|
156
157
|
# Add a non-grouped fav
|
157
158
|
def on_non_group
|
158
159
|
self.config.add(self.command_name, self.cli_options[:add])
|
159
|
-
|
160
|
+
info "Successfully added #{self.command_name}!"
|
160
161
|
end
|
161
162
|
end
|
162
163
|
|
@@ -167,13 +168,13 @@ module Fav
|
|
167
168
|
#raise error if command they are attempting to remove doesn't exist
|
168
169
|
raise "Can not remove command because it doesn't exist" unless self.config[group][self.command_name]
|
169
170
|
self.config[group].delete(self.command_name)
|
170
|
-
|
171
|
+
info "Successfully removed #{self.command_name} from the '#{group}' group!"
|
171
172
|
end
|
172
173
|
|
173
174
|
# Remove a non-grouped fav
|
174
175
|
def on_non_group
|
175
176
|
self.config.params.delete(self.command_name)
|
176
|
-
|
177
|
+
info "Successfully removed #{self.command_name}"
|
177
178
|
end
|
178
179
|
end
|
179
180
|
end
|
data/lib/fav/version.rb
CHANGED