hsume2-aka 0.1.0 → 0.2.0

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: 3369794f383200ea13fef6e746ac0c58b9f1f248
4
- data.tar.gz: 835091cbc77b20d99c2ad3b2957d204884fae358
3
+ metadata.gz: 51c5a052c633b5f271d7338546077195370f2945
4
+ data.tar.gz: 90855456998901d7c494389a4695cbd3e1624df0
5
5
  SHA512:
6
- metadata.gz: 87d76091861f959ff6deba94453faf3e8d6af4e24b256c022ec57eb4ebcc952d5dd4bf5aad166c239ea16c5b15820ece7d7809f5f181cb1337344164810ec2d0
7
- data.tar.gz: 77964a52a87358e29a1d13e18fa212c5512732cd3b372d449cc3234bb737d29da0573d1d1d589d58afc313d65f8303e7fe47caf9045bce608386d4b4b1d8ae10
6
+ metadata.gz: 4e5fa9d33652c6522a95e3a908796c05bcb62dce5ba9274e16ab1b905c1be8f44a065a071199b5c959e2d0c93445bc68006796a45fa490ad4f5d0417994ddc6f
7
+ data.tar.gz: a0ff210053fb91e05f64df65f860a0f6729fbd73303bff884912f7bd23f6ced7b3606eb0a283b2bf2546a9e2e5be6f4c26500ec51eff88b633a5ab7e6041e24c
data/.gitignore CHANGED
@@ -5,6 +5,7 @@ html
5
5
  tmp
6
6
  Gemfile.lock
7
7
  .bundle
8
+ .ruby-version
8
9
 
9
10
  # output from ronn
10
11
  lib/aka/man/
@@ -0,0 +1 @@
1
+ 2.0.0-p353
data/Guardfile CHANGED
@@ -1,6 +1,3 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
1
  guard 'cucumber', :cli => '--no-profile --color --format progress --strict --tags ~@interactive' do
5
2
  watch(%r{^lib/.+\.rb$})
6
3
  watch(%r{^features/.+\.feature$})
data/README.md CHANGED
@@ -10,7 +10,9 @@ aka(7) -- Manage Shell Keyboard Shortcuts
10
10
  `aka` edit <shortcut> \[options\]<br>
11
11
  `aka` remove <shortcut><br>
12
12
  `aka` list \[options\]<br>
13
- `aka` generate \[options\]
13
+ `aka` link \[options\]<br>
14
+ `aka` generate \[options\]<br>
15
+ `aka` sync
14
16
 
15
17
  ## DESCRIPTION
16
18
 
@@ -20,10 +22,6 @@ You can replace commonly used commands with shorter, sexier keyboard shortcuts a
20
22
 
21
23
  With **aka**, you can add, show, edit, remove, list keyboard shortcuts. On top of that you can tag shortcuts based on environment, tool, context, etc. Then, you can generate an appropriate output file for your environment.
22
24
 
23
- ## INSTALLATION
24
-
25
- $ gem install aka
26
-
27
25
  ## OPTIONS
28
26
 
29
27
  * `--help`:<br>
@@ -35,6 +33,10 @@ With **aka**, you can add, show, edit, remove, list keyboard shortcuts. On top o
35
33
  * `--log-level=<debug|info|warn|error|fatal>`:<br>
36
34
  Set the logging level (Default: info)
37
35
 
36
+ ## INSTALLATION
37
+
38
+ $ gem install hsume2-aka
39
+
38
40
  ## EXAMPLES
39
41
 
40
42
  Add a keyboard shortcut and generate the output script:
@@ -85,6 +87,30 @@ Remove a shortcut:
85
87
  $ aka remove ls
86
88
  Removes shortcut.
87
89
 
90
+ Add a link:
91
+
92
+ $ aka link --tag os:linux --output ~/.aka.zsh
93
+ Saved link.
94
+
95
+ Remove a link:
96
+
97
+ $ aka link --delete --tag os:linux --output ~/.aka.zsh
98
+ Removed link.
99
+
100
+ Synchronize links:
101
+
102
+ $ aka link --tag os:linux --output ~/.aka.zsh
103
+ Saved link.
104
+ $ aka sync
105
+ Generated ~/.aka.zsh.
106
+ 4 shortcut(s) excluded (#linux).
107
+
108
+ Upgrade links from v0 to v1:
109
+
110
+ $ aka upgrade
111
+ Upgraded ~/.aka.yml.
112
+ Backed up to ~/.aka.yml.backup."
113
+
88
114
  ## ENVIRONMENT
89
115
 
90
116
  * `AKA`:<br>
@@ -21,11 +21,13 @@ Feature: Add keyboard shortcuts
21
21
  And the file ".aka.yml" should contain exactly:
22
22
  """
23
23
  ---
24
- 1: !ruby/object:OpenStruct
25
- table:
26
- :shortcut: ls
27
- :command: ls -F --color=auto
28
- modifiable: true
24
+ :version: '1'
25
+ :shortcuts:
26
+ 1: !ruby/object:OpenStruct
27
+ table:
28
+ :shortcut: ls
29
+ :command: ls -F --color=auto
30
+ modifiable: true
29
31
 
30
32
  """
31
33
 
@@ -39,13 +41,15 @@ Feature: Add keyboard shortcuts
39
41
  And the file ".aka.yml" should contain exactly:
40
42
  """
41
43
  ---
42
- 1: !ruby/object:OpenStruct
43
- table:
44
- :shortcut: ls
45
- :command: ls -F --color=auto
46
- :tag:
47
- - os:darwin
48
- modifiable: true
44
+ :version: '1'
45
+ :shortcuts:
46
+ 1: !ruby/object:OpenStruct
47
+ table:
48
+ :shortcut: ls
49
+ :command: ls -F --color=auto
50
+ :tag:
51
+ - os:darwin
52
+ modifiable: true
49
53
 
50
54
  """
51
55
 
@@ -59,14 +63,16 @@ Feature: Add keyboard shortcuts
59
63
  And the file ".aka.yml" should contain exactly:
60
64
  """
61
65
  ---
62
- 1: !ruby/object:OpenStruct
63
- table:
64
- :shortcut: ls
65
- :command: ls -F --color=auto
66
- :tag:
67
- - A
68
- - B
69
- modifiable: true
66
+ :version: '1'
67
+ :shortcuts:
68
+ 1: !ruby/object:OpenStruct
69
+ table:
70
+ :shortcut: ls
71
+ :command: ls -F --color=auto
72
+ :tag:
73
+ - A
74
+ - B
75
+ modifiable: true
70
76
 
71
77
  """
72
78
 
@@ -81,21 +87,23 @@ Feature: Add keyboard shortcuts
81
87
  And the file ".aka.yml" should contain exactly:
82
88
  """
83
89
  ---
84
- 1: !ruby/object:OpenStruct
85
- table:
86
- :shortcut: ls
87
- :command: ls -FG
88
- :tag:
89
- - A
90
- - B
91
- modifiable: true
92
- 2: !ruby/object:OpenStruct
93
- table:
94
- :shortcut: ls
95
- :command: ls -FG
96
- :tag:
97
- - C
98
- modifiable: true
90
+ :version: '1'
91
+ :shortcuts:
92
+ 1: !ruby/object:OpenStruct
93
+ table:
94
+ :shortcut: ls
95
+ :command: ls -FG
96
+ :tag:
97
+ - A
98
+ - B
99
+ modifiable: true
100
+ 2: !ruby/object:OpenStruct
101
+ table:
102
+ :shortcut: ls
103
+ :command: ls -FG
104
+ :tag:
105
+ - C
106
+ modifiable: true
99
107
 
100
108
  """
101
109
 
@@ -112,11 +120,13 @@ Feature: Add keyboard shortcuts
112
120
  And the file ".aka.yml" should contain exactly:
113
121
  """
114
122
  ---
115
- 1: !ruby/object:OpenStruct
116
- table:
117
- :shortcut: ls
118
- :command: ls -F --color=auto
119
- modifiable: true
123
+ :version: '1'
124
+ :shortcuts:
125
+ 1: !ruby/object:OpenStruct
126
+ table:
127
+ :shortcut: ls
128
+ :command: ls -F --color=auto
129
+ modifiable: true
120
130
 
121
131
  """
122
132
 
@@ -133,11 +143,13 @@ Feature: Add keyboard shortcuts
133
143
  And the file ".aka.yml" should contain exactly:
134
144
  """
135
145
  ---
136
- 1: !ruby/object:OpenStruct
137
- table:
138
- :shortcut: ls
139
- :command: ls -FG
140
- modifiable: true
146
+ :version: '1'
147
+ :shortcuts:
148
+ 1: !ruby/object:OpenStruct
149
+ table:
150
+ :shortcut: ls
151
+ :command: ls -FG
152
+ modifiable: true
141
153
 
142
154
  """
143
155
 
@@ -151,12 +163,14 @@ Feature: Add keyboard shortcuts
151
163
  And the file ".aka.yml" should contain exactly:
152
164
  """
153
165
  ---
154
- 1: !ruby/object:OpenStruct
155
- table:
156
- :shortcut: ls
157
- :command: ls -F --color=auto
158
- :function: true
159
- modifiable: true
166
+ :version: '1'
167
+ :shortcuts:
168
+ 1: !ruby/object:OpenStruct
169
+ table:
170
+ :shortcut: ls
171
+ :command: ls -F --color=auto
172
+ :function: true
173
+ modifiable: true
160
174
 
161
175
  """
162
176
 
@@ -170,14 +184,16 @@ Feature: Add keyboard shortcuts
170
184
  And the file ".aka.yml" should contain exactly:
171
185
  """
172
186
  ---
173
- 1: !ruby/object:OpenStruct
174
- table:
175
- :shortcut: ls
176
- :command: ls -F --color=auto
177
- :description: |-
178
- ls
179
- ls
180
- ls
181
- modifiable: true
187
+ :version: '1'
188
+ :shortcuts:
189
+ 1: !ruby/object:OpenStruct
190
+ table:
191
+ :shortcut: ls
192
+ :command: ls -F --color=auto
193
+ :description: |-
194
+ ls
195
+ ls
196
+ ls
197
+ modifiable: true
182
198
 
183
199
  """
@@ -35,19 +35,21 @@ Feature: Edit keyboard shortcuts
35
35
  And the file ".aka.yml" should contain exactly:
36
36
  """
37
37
  ---
38
- 1: !ruby/object:OpenStruct
39
- table:
40
- :shortcut: lsf
41
- :command: ls -F
42
- :description: |-
43
- 1
44
- 2
45
- 3
46
- :function: true
47
- :tag:
48
- - zsh
49
- - bash
50
- modifiable: true
38
+ :version: '1'
39
+ :shortcuts:
40
+ 1: !ruby/object:OpenStruct
41
+ table:
42
+ :shortcut: lsf
43
+ :command: ls -F
44
+ :description: |-
45
+ 1
46
+ 2
47
+ 3
48
+ :function: true
49
+ :tag:
50
+ - zsh
51
+ - bash
52
+ modifiable: true
51
53
 
52
54
  """
53
55
 
@@ -65,19 +67,21 @@ Feature: Edit keyboard shortcuts
65
67
  And the file ".aka.yml" should contain exactly:
66
68
  """
67
69
  ---
68
- 1: !ruby/object:OpenStruct
69
- table:
70
- :shortcut: lsf
71
- :command: ls -F
72
- :description: |-
73
- 1
74
- 2
75
- 3
76
- :function: true
77
- :tag:
78
- - zsh
79
- - bash
80
- modifiable: true
70
+ :version: '1'
71
+ :shortcuts:
72
+ 1: !ruby/object:OpenStruct
73
+ table:
74
+ :shortcut: lsf
75
+ :command: ls -F
76
+ :description: |-
77
+ 1
78
+ 2
79
+ 3
80
+ :function: true
81
+ :tag:
82
+ - zsh
83
+ - bash
84
+ modifiable: true
81
85
 
82
86
  """
83
87
 
@@ -29,7 +29,7 @@ Feature: Help with aka
29
29
  Then the exit status should be 0
30
30
  And the output should contain exactly:
31
31
  """
32
- aka version 0.1.0
32
+ aka version 0.2.0
33
33
 
34
34
  """
35
35
 
@@ -78,3 +78,27 @@ Feature: Help with aka
78
78
  """
79
79
  aka-edit - Edit keyboard shortcuts
80
80
  """
81
+
82
+ Scenario: Help linking shortcuts
83
+ When I run `aka -h link`
84
+ Then the exit status should be 0
85
+ And the output should contain:
86
+ """
87
+ aka-link - Link keyboard shortcuts
88
+ """
89
+
90
+ Scenario: Help syncing shortcuts
91
+ When I run `aka -h sync`
92
+ Then the exit status should be 0
93
+ And the output should contain:
94
+ """
95
+ aka-sync - Synchronize keyboard shortcuts
96
+ """
97
+
98
+ Scenario: Help upgrading shortcuts
99
+ When I run `aka -h upgrade`
100
+ Then the exit status should be 0
101
+ And the output should contain:
102
+ """
103
+ aka-upgrade - Upgrade keyboard shortcuts
104
+ """
@@ -0,0 +1,275 @@
1
+ Feature: Link keyboard shortcuts
2
+ In order to keep my shortcuts up to date
3
+ I want to have a tool for configuring shell keyboard shortcuts
4
+ So I don't have to do it myself
5
+
6
+ Background:
7
+ Given a file named ".aka.yml" should not exist
8
+ And I set the AKA environment variable to the ".aka.yml" file in the working directory
9
+ And I set the environment variables to:
10
+ | variable | value |
11
+ | NO_MAN | 1 |
12
+
13
+
14
+ Scenario: Add a link
15
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
16
+ And I run `aka add ls "ls -FG" --tag os:darwin`
17
+ And I run `aka add .. "cd .."`
18
+ When I run `aka link --tag os:darwin --output .aka.zsh`
19
+ Then the exit status should be 0
20
+ And the stdout should contain exactly:
21
+ """
22
+ Created shortcut.
23
+ Created shortcut.
24
+ Created shortcut.
25
+ Saved link.
26
+
27
+ """
28
+ And the file ".aka.yml" should contain exactly:
29
+ """
30
+ ---
31
+ :version: '1'
32
+ :shortcuts:
33
+ 1: !ruby/object:OpenStruct
34
+ table:
35
+ :shortcut: ls
36
+ :command: ls -F --color=auto
37
+ :tag:
38
+ - os:linux
39
+ :description: |-
40
+ ls
41
+ ls
42
+ ls
43
+ :function: true
44
+ modifiable: true
45
+ 2: !ruby/object:OpenStruct
46
+ table:
47
+ :shortcut: ls
48
+ :command: ls -FG
49
+ :tag:
50
+ - os:darwin
51
+ modifiable: true
52
+ 3: !ruby/object:OpenStruct
53
+ table:
54
+ :shortcut: ..
55
+ :command: cd ..
56
+ modifiable: true
57
+ :links:
58
+ - !ruby/object:OpenStruct
59
+ table:
60
+ :tag:
61
+ - os:darwin
62
+ :output: .aka.zsh
63
+ modifiable: true
64
+
65
+ """
66
+
67
+ Scenario: Add the same link
68
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
69
+ And I run `aka add ls "ls -FG" --tag os:darwin`
70
+ And I run `aka add .. "cd .."`
71
+ When I run `aka link --tag os:darwin --output .aka.zsh`
72
+ And I run `aka link --tag os:darwin --output .aka.zsh`
73
+ Then the exit status should be 0
74
+ And the stdout should contain exactly:
75
+ """
76
+ Created shortcut.
77
+ Created shortcut.
78
+ Created shortcut.
79
+ Saved link.
80
+ Saved link.
81
+
82
+ """
83
+ And the file ".aka.yml" should contain exactly:
84
+ """
85
+ ---
86
+ :version: '1'
87
+ :shortcuts:
88
+ 1: !ruby/object:OpenStruct
89
+ table:
90
+ :shortcut: ls
91
+ :command: ls -F --color=auto
92
+ :tag:
93
+ - os:linux
94
+ :description: |-
95
+ ls
96
+ ls
97
+ ls
98
+ :function: true
99
+ modifiable: true
100
+ 2: !ruby/object:OpenStruct
101
+ table:
102
+ :shortcut: ls
103
+ :command: ls -FG
104
+ :tag:
105
+ - os:darwin
106
+ modifiable: true
107
+ 3: !ruby/object:OpenStruct
108
+ table:
109
+ :shortcut: ..
110
+ :command: cd ..
111
+ modifiable: true
112
+ :links:
113
+ - !ruby/object:OpenStruct
114
+ table:
115
+ :tag:
116
+ - os:darwin
117
+ :output: .aka.zsh
118
+ modifiable: true
119
+
120
+ """
121
+
122
+ Scenario: Add a link with invalid options
123
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
124
+ And I run `aka add ls "ls -FG" --tag os:darwin`
125
+ And I run `aka add .. "cd .."`
126
+ When I run `aka link`
127
+ Then the exit status should not be 0
128
+ And the stdout should contain exactly:
129
+ """
130
+ Created shortcut.
131
+ Created shortcut.
132
+ Created shortcut.
133
+
134
+ """
135
+ And the stderr should contain exactly:
136
+ """
137
+ Invalid link.
138
+
139
+ """
140
+ And the file ".aka.yml" should contain exactly:
141
+ """
142
+ ---
143
+ :version: '1'
144
+ :shortcuts:
145
+ 1: !ruby/object:OpenStruct
146
+ table:
147
+ :shortcut: ls
148
+ :command: ls -F --color=auto
149
+ :tag:
150
+ - os:linux
151
+ :description: |-
152
+ ls
153
+ ls
154
+ ls
155
+ :function: true
156
+ modifiable: true
157
+ 2: !ruby/object:OpenStruct
158
+ table:
159
+ :shortcut: ls
160
+ :command: ls -FG
161
+ :tag:
162
+ - os:darwin
163
+ modifiable: true
164
+ 3: !ruby/object:OpenStruct
165
+ table:
166
+ :shortcut: ..
167
+ :command: cd ..
168
+ modifiable: true
169
+
170
+ """
171
+
172
+ Scenario: Remove a link
173
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
174
+ And I run `aka add ls "ls -FG" --tag os:darwin`
175
+ And I run `aka add .. "cd .."`
176
+ And I run `aka link --tag os:darwin --output .aka.zsh`
177
+ When I run `aka link --delete --tag os:darwin --output .aka.zsh`
178
+ Then the exit status should be 0
179
+ And the stdout should contain exactly:
180
+ """
181
+ Created shortcut.
182
+ Created shortcut.
183
+ Created shortcut.
184
+ Saved link.
185
+ Deleted link.
186
+
187
+ """
188
+ And the file ".aka.yml" should contain exactly:
189
+ """
190
+ ---
191
+ :version: '1'
192
+ :shortcuts:
193
+ 1: !ruby/object:OpenStruct
194
+ table:
195
+ :shortcut: ls
196
+ :command: ls -F --color=auto
197
+ :tag:
198
+ - os:linux
199
+ :description: |-
200
+ ls
201
+ ls
202
+ ls
203
+ :function: true
204
+ modifiable: true
205
+ 2: !ruby/object:OpenStruct
206
+ table:
207
+ :shortcut: ls
208
+ :command: ls -FG
209
+ :tag:
210
+ - os:darwin
211
+ modifiable: true
212
+ 3: !ruby/object:OpenStruct
213
+ table:
214
+ :shortcut: ..
215
+ :command: cd ..
216
+ modifiable: true
217
+
218
+ """
219
+
220
+ Scenario: Sync a link
221
+ Given a file named ".aka.zsh" should not exist
222
+ And I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
223
+ And I run `aka add ls "ls -FG" --tag os:darwin`
224
+ And I run `aka add .. "cd .."`
225
+ And I run `aka link --tag os:darwin --output .aka.zsh`
226
+ When I run `aka sync`
227
+ Then the exit status should be 0
228
+ And the stdout should contain exactly:
229
+ """
230
+ Created shortcut.
231
+ Created shortcut.
232
+ Created shortcut.
233
+ Saved link.
234
+ Generated .aka.zsh.
235
+
236
+ """
237
+ And the file ".aka.zsh" should contain exactly:
238
+ """
239
+ alias ..="cd .."
240
+ alias ls="ls -FG"
241
+
242
+ """
243
+
244
+ Scenario: List links
245
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
246
+ And I run `aka add ls "ls -FG" --tag os:darwin`
247
+ And I run `aka add .. "cd .."`
248
+ And I run `aka link --tag os:darwin --output .aka.zsh`
249
+ When I run `aka list`
250
+ Then the exit status should be 0
251
+ And the output should contain exactly:
252
+ """
253
+ Created shortcut.
254
+ Created shortcut.
255
+ Created shortcut.
256
+ Saved link.
257
+ #default
258
+ ========
259
+ .. cd ..
260
+
261
+ #os:linux
262
+ =========
263
+ ls ls; ls; ls
264
+
265
+ #os:darwin
266
+ ==========
267
+ ls ls -FG
268
+
269
+ =====
270
+ Links
271
+ =====
272
+
273
+ .aka.zsh: #os:darwin
274
+
275
+ """
@@ -22,7 +22,9 @@ Feature: Remove keyboard shortcuts
22
22
  """
23
23
  And the file ".aka.yml" should contain exactly:
24
24
  """
25
- --- {}
25
+ ---
26
+ :version: '1'
27
+ :shortcuts: {}
26
28
 
27
29
  """
28
30
 
@@ -39,10 +41,12 @@ Feature: Remove keyboard shortcuts
39
41
  And the file ".aka.yml" should contain exactly:
40
42
  """
41
43
  ---
42
- 1: !ruby/object:OpenStruct
43
- table:
44
- :shortcut: ls
45
- :command: ls -F --color=auto
46
- modifiable: true
44
+ :version: '1'
45
+ :shortcuts:
46
+ 1: !ruby/object:OpenStruct
47
+ table:
48
+ :shortcut: ls
49
+ :command: ls -F --color=auto
50
+ modifiable: true
47
51
 
48
52
  """