hsume2-aka 0.2.1 → 0.3.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: a332ce58ae2a121737edee3fc627727f0fcba0c0
4
- data.tar.gz: 1a0f345cb28c9464c937187b079774a1e97ff0d3
3
+ metadata.gz: ff1a4426d8acd44942815927f6598abeced762cf
4
+ data.tar.gz: 5c595720a99c74f596a9ea20a47daf510d75af34
5
5
  SHA512:
6
- metadata.gz: 2235293919da1a0b43f0b382018c668f2cc0c4326e8e7efeacbbadbe7acd1aac97ed743a6d3cf4b7feb8b153862197ee4ed265b2414a13588f535c80fcea5800
7
- data.tar.gz: 49fe5054009caaa9106bb4eb840705dbe99bdf46e52af4bcce5a0aaeb6b29683e4fe01cbb8370a190a4274aeeed005f4fb4f6fe555fe6bcf6669d7e8f5412c9a
6
+ metadata.gz: 660d9898f7a0e020ee5f847d52eba91cb686d1b41414b13aa56ee92db4780ceb3d2a9363914593e7d66522683d149705f7f64f46e1d94b9cea2be23e97e5718c
7
+ data.tar.gz: e757d3583c75e7670a66aad84b75d5442024f170ab28c14325f7ecca254194b2d22d803541bc2a9b70a0f453ab7ebd3de7cc30037ecae6e73da2512352d7cb93
data/README.md CHANGED
@@ -12,7 +12,8 @@ aka(7) -- Manage Shell Keyboard Shortcuts
12
12
  `aka` list \[options\]<br>
13
13
  `aka` link \[options\]<br>
14
14
  `aka` generate \[options\]<br>
15
- `aka` sync
15
+ `aka` sync<br>
16
+ `aka` upgrade
16
17
 
17
18
  ## DESCRIPTION
18
19
 
@@ -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.2.1
32
+ aka version 0.3.0
33
33
 
34
34
  """
35
35
 
@@ -55,12 +55,12 @@ Feature: Link keyboard shortcuts
55
55
  :command: cd ..
56
56
  modifiable: true
57
57
  :links:
58
- - !ruby/object:OpenStruct
59
- table:
60
- :tag:
61
- - os:darwin
62
- :output: .aka.zsh
63
- modifiable: true
58
+ 1: !ruby/object:OpenStruct
59
+ table:
60
+ :tag:
61
+ - os:darwin
62
+ :output: .aka.zsh
63
+ modifiable: true
64
64
 
65
65
  """
66
66
 
@@ -110,12 +110,12 @@ Feature: Link keyboard shortcuts
110
110
  :command: cd ..
111
111
  modifiable: true
112
112
  :links:
113
- - !ruby/object:OpenStruct
114
- table:
115
- :tag:
116
- - os:darwin
117
- :output: .aka.zsh
118
- modifiable: true
113
+ 1: !ruby/object:OpenStruct
114
+ table:
115
+ :tag:
116
+ - os:darwin
117
+ :output: .aka.zsh
118
+ modifiable: true
119
119
 
120
120
  """
121
121
 
@@ -174,7 +174,7 @@ Feature: Link keyboard shortcuts
174
174
  And I run `aka add ls "ls -FG" --tag os:darwin`
175
175
  And I run `aka add .. "cd .."`
176
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`
177
+ When I run `aka link delete 1`
178
178
  Then the exit status should be 0
179
179
  And the stdout should contain exactly:
180
180
  """
@@ -217,12 +217,37 @@ Feature: Link keyboard shortcuts
217
217
 
218
218
  """
219
219
 
220
- Scenario: Sync a link
220
+ Scenario: Sync 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: Sync links
221
245
  Given a file named ".aka.zsh" should not exist
222
246
  And I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
223
247
  And I run `aka add ls "ls -FG" --tag os:darwin`
224
248
  And I run `aka add .. "cd .."`
225
249
  And I run `aka link --tag os:darwin --output .aka.zsh`
250
+ And I run `aka link --tag os:linux --output .aka2.zsh`
226
251
  When I run `aka sync`
227
252
  Then the exit status should be 0
228
253
  And the stdout should contain exactly:
@@ -231,7 +256,9 @@ Feature: Link keyboard shortcuts
231
256
  Created shortcut.
232
257
  Created shortcut.
233
258
  Saved link.
259
+ Saved link.
234
260
  Generated .aka.zsh.
261
+ Generated .aka2.zsh.
235
262
 
236
263
  """
237
264
  And the file ".aka.zsh" should contain exactly:
@@ -240,6 +267,43 @@ Feature: Link keyboard shortcuts
240
267
  alias ls="ls -FG"
241
268
 
242
269
  """
270
+ And the file ".aka2.zsh" should contain exactly:
271
+ """
272
+ alias ..="cd .."
273
+ function ls {
274
+ ls -F --color=auto
275
+ }
276
+
277
+ """
278
+
279
+ Scenario: Sync specific link
280
+ Given a file named ".aka.zsh" should not exist
281
+ And I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
282
+ And I run `aka add ls "ls -FG" --tag os:darwin`
283
+ And I run `aka add .. "cd .."`
284
+ And I run `aka link --tag os:darwin --output .aka.zsh`
285
+ And I run `aka link --tag os:linux --output .aka2.zsh`
286
+ When I run `aka sync 2`
287
+ Then the exit status should be 0
288
+ And the stdout should contain exactly:
289
+ """
290
+ Created shortcut.
291
+ Created shortcut.
292
+ Created shortcut.
293
+ Saved link.
294
+ Saved link.
295
+ Generated .aka2.zsh.
296
+
297
+ """
298
+ And the file ".aka.zsh" should not exist
299
+ And the file ".aka2.zsh" should contain exactly:
300
+ """
301
+ alias ..="cd .."
302
+ function ls {
303
+ ls -F --color=auto
304
+ }
305
+
306
+ """
243
307
 
244
308
  Scenario: List links
245
309
  Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
@@ -270,6 +334,6 @@ Feature: Link keyboard shortcuts
270
334
  Links
271
335
  =====
272
336
 
273
- .aka.zsh: #os:darwin
337
+ [1] .aka.zsh: #os:darwin
274
338
 
275
339
  """
@@ -49,3 +49,89 @@ Feature: Upgrade aka
49
49
  modifiable: true
50
50
 
51
51
  """
52
+
53
+ Scenario: Upgrade from v1 to v2
54
+ Given a file named ".aka.yml" with:
55
+ """
56
+ ---
57
+ :version: '1'
58
+ :shortcuts:
59
+ 1: !ruby/object:OpenStruct
60
+ table:
61
+ :shortcut: ls
62
+ :command: ls -F --color=auto
63
+ :tag:
64
+ - os:linux
65
+ :description: |-
66
+ ls
67
+ ls
68
+ ls
69
+ :function: true
70
+ modifiable: true
71
+ :links:
72
+ - !ruby/object:OpenStruct
73
+ table:
74
+ :tag:
75
+ - os:darwin
76
+ :output: .aka.zsh
77
+ modifiable: true
78
+
79
+ """
80
+ When I run `aka upgrade`
81
+ Then the exit status should be 0
82
+ And the file ".aka.yml" should contain exactly:
83
+ """
84
+ ---
85
+ :version: '2'
86
+ :shortcuts:
87
+ 1: !ruby/object:OpenStruct
88
+ table:
89
+ :shortcut: ls
90
+ :command: ls -F --color=auto
91
+ :tag:
92
+ - os:linux
93
+ :description: |-
94
+ ls
95
+ ls
96
+ ls
97
+ :function: true
98
+ modifiable: true
99
+ :links:
100
+ 1: !ruby/object:OpenStruct
101
+ table:
102
+ :tag:
103
+ - os:darwin
104
+ :output: .aka.zsh
105
+ modifiable: true
106
+
107
+ """
108
+ And the stdout should contain "Upgraded"
109
+ And the stdout should contain ".aka.yml"
110
+ And the stdout should contain "Backed up to"
111
+ And the stdout should contain ".aka.yml.backup"
112
+ And the file ".aka.yml.backup" should contain exactly:
113
+ """
114
+ ---
115
+ :version: '1'
116
+ :shortcuts:
117
+ 1: !ruby/object:OpenStruct
118
+ table:
119
+ :shortcut: ls
120
+ :command: ls -F --color=auto
121
+ :tag:
122
+ - os:linux
123
+ :description: |-
124
+ ls
125
+ ls
126
+ ls
127
+ :function: true
128
+ modifiable: true
129
+ :links:
130
+ - !ruby/object:OpenStruct
131
+ table:
132
+ :tag:
133
+ - os:darwin
134
+ :output: .aka.zsh
135
+ modifiable: true
136
+
137
+ """
data/lib/aka/app.rb CHANGED
@@ -44,11 +44,15 @@ module Aka
44
44
  when 'show'
45
45
  store.show(options)
46
46
  when 'link'
47
- store.link(options)
47
+ if shortcut == 'delete'
48
+ store.unlink(script.to_i)
49
+ else
50
+ store.link(options)
51
+ end
48
52
  when 'upgrade'
49
53
  store.upgrade(options)
50
54
  when 'sync'
51
- store.sync
55
+ store.sync(shortcut ? shortcut.to_i : nil)
52
56
  else
53
57
  store.help(command, options)
54
58
  end
@@ -76,12 +76,14 @@ module Aka
76
76
  end
77
77
 
78
78
  def links
79
- @links ||= Links.new(@configuration[:links] || [])
79
+ @links ||= Links.new(@configuration[:links] || {})
80
80
  end
81
81
 
82
82
  def upgrade
83
83
  if !version
84
- Upgrader::FromV0.run(aka_yml)
84
+ Upgrader::FromV0ToV1.run(aka_yml)
85
+ elsif version == '1'
86
+ Upgrader::FromV1ToV2.run(aka_yml)
85
87
  end
86
88
  end
87
89
 
data/lib/aka/links.rb CHANGED
@@ -6,12 +6,11 @@ module Aka
6
6
 
7
7
  def add(link)
8
8
  link = Configuration::Link.parse(link)
9
- @links << link unless @links.include?(link)
9
+ @links[count + 1] = link unless @links.find { |_, l| l == link }
10
10
  end
11
11
 
12
- def delete(link)
13
- link = Configuration::Link.parse(link)
14
- @links.delete(link)
12
+ def delete(key)
13
+ @links.delete(key)
15
14
  end
16
15
 
17
16
  def any?
@@ -25,5 +24,10 @@ module Aka
25
24
  def each(&blk)
26
25
  @links.each(&blk)
27
26
  end
27
+
28
+ def count
29
+ result, _ = @links.max { |(n, _)| n }
30
+ result || 0
31
+ end
28
32
  end
29
33
  end
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-ADD" "1" "February 2014" "" ""
4
+ .TH "AKA\-ADD" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-add\fR \- Add keyboard shortcuts
@@ -28,4 +28,4 @@ SEE ALSO
28
28
 
29
29
 
30
30
 
31
- February 2014 AKA-ADD(1)
31
+ April 2014 AKA-ADD(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-EDIT" "1" "February 2014" "" ""
4
+ .TH "AKA\-EDIT" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-edit\fR \- Edit keyboard shortcuts
@@ -72,4 +72,4 @@ SEE ALSO
72
72
 
73
73
 
74
74
 
75
- February 2014 AKA-EDIT(1)
75
+ April 2014 AKA-EDIT(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-GENERATE" "1" "February 2014" "" ""
4
+ .TH "AKA\-GENERATE" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-generate\fR \- Generate commands for loading keyboard shortcuts into your shell
@@ -67,4 +67,4 @@ SEE ALSO
67
67
 
68
68
 
69
69
 
70
- February 2014 AKA-GENERATE(1)
70
+ April 2014 AKA-GENERATE(1)
@@ -1,13 +1,16 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-LINK" "1" "March 2014" "" ""
4
+ .TH "AKA\-LINK" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-link\fR \- Link keyboard shortcuts
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBaka link\fR [\fB\-t\fR \fItag1\fR[,\fItag2\fR\.\.\.]] [\fB\-o\fR \fIoutput\fR] [\fB\-\-delete\fR]
10
+ \fBaka link\fR [\fB\-t\fR \fItag1\fR[,\fItag2\fR\.\.\.]] [\fB\-o\fR \fIoutput\fR]
11
+ .
12
+ .br
13
+ \fBaka link\fR \fBdelete\fR \fIlink\fR
11
14
  .
12
15
  .SH "DESCRIPTION"
13
16
  This command manages keyboard shortcuts links in \fBaka(7)\fR\.
@@ -26,8 +29,8 @@ A comma\-separated list of tags to filter with\. Shortcuts tagged with \fItag1\f
26
29
  The location to link the output to\.
27
30
  .
28
31
  .TP
29
- \fB\-\-delete\fR
30
- Delete the link with the given options\.
32
+ \fBdelete\fR \fIlink\fR
33
+ Delete the link with id \fIlink\fR\.
31
34
  .
32
35
  .SH "EXAMPLES"
33
36
  Add a link:
@@ -36,7 +39,7 @@ Add a link:
36
39
  .
37
40
  .nf
38
41
 
39
- $ aka link \-\-tag os:linux \-\-output ~/\.aka\.zsh
42
+ $ aka link \-\-tag os:linux \-\-output \e~/\.aka\.zsh
40
43
  Saved link\.
41
44
  .
42
45
  .fi
@@ -50,7 +53,15 @@ Remove a link:
50
53
  .
51
54
  .nf
52
55
 
53
- $ aka link \-\-delete \-\-tag os:linux \-\-output ~/\.aka\.zsh
56
+ $ aka list
57
+ \.\.\.
58
+ =====
59
+ Links
60
+ =====
61
+
62
+ [1] ~/\.aka\.zsh: #osx, #git
63
+ [2] ~/\.aka\.zsh: #linux, #git
64
+ $ aka link delete 2
54
65
  Removed link\.
55
66
  .
56
67
  .fi
@@ -6,7 +6,8 @@ NAME
6
6
  aka-link - Link keyboard shortcuts
7
7
 
8
8
  SYNOPSIS
9
- aka link [-t tag1[,tag2...]] [-o output] [--delete]
9
+ aka link [-t tag1[,tag2...]] [-o output]
10
+ aka link delete link
10
11
 
11
12
  DESCRIPTION
12
13
  This command manages keyboard shortcuts links in aka(7).
@@ -24,15 +25,15 @@ OPTIONS
24
25
  -o <output>
25
26
  The location to link the output to.
26
27
 
27
- --delete
28
- Delete the link with the given options.
28
+ delete link
29
+ Delete the link with id link.
29
30
 
30
31
  EXAMPLES
31
32
  Add a link:
32
33
 
33
34
 
34
35
 
35
- $ aka link --tag os:linux --output ~/.aka.zsh
36
+ $ aka link --tag os:linux --output \~/.aka.zsh
36
37
  Saved link.
37
38
 
38
39
 
@@ -41,7 +42,14 @@ EXAMPLES
41
42
 
42
43
 
43
44
 
44
- $ aka link --delete --tag os:linux --output ~/.aka.zsh
45
+ $ aka list
46
+ =====
47
+ Links
48
+ =====
49
+
50
+ [1] ~/.aka.zsh: #osx, #git
51
+ [2] ~/.aka.zsh: #linux, #git
52
+ $ aka link delete 2
45
53
  Removed link.
46
54
 
47
55
 
@@ -51,4 +59,4 @@ SEE ALSO
51
59
 
52
60
 
53
61
 
54
- March 2014 AKA-LINK(1)
62
+ April 2014 AKA-LINK(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-LIST" "1" "March 2014" "" ""
4
+ .TH "AKA\-LIST" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-list\fR \- List keyboard shortcuts
@@ -60,4 +60,4 @@ SEE ALSO
60
60
 
61
61
 
62
62
 
63
- March 2014 AKA-LIST(1)
63
+ April 2014 AKA-LIST(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-REMOVE" "1" "February 2014" "" ""
4
+ .TH "AKA\-REMOVE" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-remove\fR \- Remove keyboard shortcuts
@@ -26,4 +26,4 @@ SEE ALSO
26
26
 
27
27
 
28
28
 
29
- February 2014 AKA-REMOVE(1)
29
+ April 2014 AKA-REMOVE(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-SHOW" "1" "February 2014" "" ""
4
+ .TH "AKA\-SHOW" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-show\fR \- Show keyboard shortcuts
@@ -28,4 +28,4 @@ SEE ALSO
28
28
 
29
29
 
30
30
 
31
- February 2014 AKA-SHOW(1)
31
+ April 2014 AKA-SHOW(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-SYNC" "1" "March 2014" "" ""
4
+ .TH "AKA\-SYNC" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-sync\fR \- Synchronize keyboard shortcuts
@@ -15,6 +15,12 @@ This command manages synchronizes keyboard shortcuts links in \fBaka(7)\fR\.
15
15
  .P
16
16
  Any links you\'ve created will be generated to the designated \fBoutput\fR with the given \fBtags\fR\.
17
17
  .
18
+ .SH "OPTIONS"
19
+ .
20
+ .TP
21
+ \fB<link>\fR
22
+ Provide the id of a specific link to synchronize\.
23
+ .
18
24
  .SH "EXAMPLES"
19
25
  Synchronize links:
20
26
  .
@@ -33,4 +39,4 @@ Generated ~/\.aka\.zsh\.
33
39
  .IP "" 0
34
40
  .
35
41
  .SH "SEE ALSO"
36
- \fBaka(7)\fR, \fBaka\-link(1)\fR
42
+ \fBaka(7)\fR, \fBaka\-link(1)\fR, \fBaka\-list(1)\fR
@@ -14,6 +14,9 @@ DESCRIPTION
14
14
  Any links you've created will be generated to the designated output
15
15
  with the given tags.
16
16
 
17
+ OPTIONS
18
+ <link> Provide the id of a specific link to synchronize.
19
+
17
20
  EXAMPLES
18
21
  Synchronize links:
19
22
 
@@ -28,8 +31,8 @@ EXAMPLES
28
31
 
29
32
 
30
33
  SEE ALSO
31
- aka(7), aka-link(1)
34
+ aka(7), aka-link(1), aka-list(1)
32
35
 
33
36
 
34
37
 
35
- March 2014 AKA-SYNC(1)
38
+ April 2014 AKA-SYNC(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA\-UPGRADE" "1" "March 2014" "" ""
4
+ .TH "AKA\-UPGRADE" "1" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\-upgrade\fR \- Upgrade keyboard shortcuts
@@ -21,7 +21,7 @@ Upgrade links from v0 to v1:
21
21
 
22
22
  $ aka upgrade
23
23
  Upgraded ~/\.aka\.yml\.
24
- Backed up to ~/\.aka\.yml\.backup\."
24
+ Backed up to ~/\.aka\.yml\.backup\.
25
25
  .
26
26
  .fi
27
27
  .
@@ -9,7 +9,7 @@ SYNOPSIS
9
9
  aka upgrade
10
10
 
11
11
  DESCRIPTION
12
- This command manages upgrades the keyboard shortcuts format in aka(7).
12
+ This command manages upgrades the keyboard shortcuts format in aka(7).
13
13
 
14
14
  EXAMPLES
15
15
  Upgrade links from v0 to v1:
@@ -18,7 +18,7 @@ EXAMPLES
18
18
 
19
19
  $ aka upgrade
20
20
  Upgraded ~/.aka.yml.
21
- Backed up to ~/.aka.yml.backup."
21
+ Backed up to ~/.aka.yml.backup.
22
22
 
23
23
 
24
24
 
@@ -27,4 +27,4 @@ SEE ALSO
27
27
 
28
28
 
29
29
 
30
- March 2014 AKA-UPGRADE(1)
30
+ April 2014 AKA-UPGRADE(1)
data/lib/aka/man/aka.7 CHANGED
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "AKA" "7" "March 2014" "" ""
4
+ .TH "AKA" "7" "April 2014" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBaka\fR \- Manage Shell Keyboard Shortcuts
@@ -30,6 +30,9 @@
30
30
  .br
31
31
  \fBaka\fR sync
32
32
  .
33
+ .br
34
+ \fBaka\fR upgrade
35
+ .
33
36
  .SH "DESCRIPTION"
34
37
  \fBaka\fR is an easy way to manage keyboard shortcuts in UNIX shells\.
35
38
  .
@@ -185,7 +188,15 @@ Remove a link:
185
188
  .
186
189
  .nf
187
190
 
188
- $ aka link \-\-delete \-\-tag os:linux \-\-output ~/\.aka\.zsh
191
+ $ aka list
192
+ \.\.\.
193
+ =====
194
+ Links
195
+ =====
196
+
197
+ [1] ~/\.aka\.zsh: #osx, #git
198
+ [2] ~/\.aka\.zsh: #linux, #git
199
+ $ aka link delete 2
189
200
  Removed link\.
190
201
  .
191
202
  .fi
@@ -14,6 +14,7 @@ SYNOPSIS
14
14
  aka link [options]
15
15
  aka generate [options]
16
16
  aka sync
17
+ aka upgrade
17
18
 
18
19
  DESCRIPTION
19
20
  aka is an easy way to manage keyboard shortcuts in UNIX shells.
@@ -125,7 +126,14 @@ EXAMPLES
125
126
 
126
127
 
127
128
 
128
- $ aka link --delete --tag os:linux --output ~/.aka.zsh
129
+ $ aka list
130
+ =====
131
+ Links
132
+ =====
133
+
134
+ [1] ~/.aka.zsh: #osx, #git
135
+ [2] ~/.aka.zsh: #linux, #git
136
+ $ aka link delete 2
129
137
  Removed link.
130
138
 
131
139
 
@@ -160,4 +168,4 @@ ENVIRONMENT
160
168
 
161
169
 
162
170
 
163
- March 2014 AKA(7)
171
+ April 2014 AKA(7)
data/lib/aka/shortcuts.rb CHANGED
@@ -8,12 +8,12 @@ module Aka
8
8
  @shortcuts[count + 1] = shortcut
9
9
  end
10
10
 
11
- def replace(index, shortcut)
12
- @shortcuts[index] = shortcut
11
+ def replace(key, shortcut)
12
+ @shortcuts[key] = shortcut
13
13
  end
14
14
 
15
- def delete(index)
16
- @shortcuts.delete(index)
15
+ def delete(key)
16
+ @shortcuts.delete(key)
17
17
  end
18
18
 
19
19
  def count
@@ -56,7 +56,7 @@ module Aka
56
56
  end
57
57
 
58
58
  if options[:output]
59
- File.open(options[:output], 'w+') do |f|
59
+ File.open(File.expand_path(options[:output]), 'w+') do |f|
60
60
  scripts.each do |script|
61
61
  f.puts script
62
62
  end
data/lib/aka/store.rb CHANGED
@@ -73,8 +73,8 @@ module Aka
73
73
  puts "====="
74
74
  puts
75
75
 
76
- configuration.links.each do |link|
77
- puts "#{link.output}: #{link.tag.map { |tag| "##{tag}" }.join(', ')}"
76
+ configuration.links.each do |index, link|
77
+ puts "[#{index}] #{link.output}: #{link.tag.map { |tag| "##{tag}" }.join(', ')}"
78
78
  end
79
79
  end
80
80
 
@@ -104,19 +104,20 @@ module Aka
104
104
  end
105
105
 
106
106
  def link(options)
107
- unless options[:delete]
108
- configuration.links.add(options)
109
- configuration.save
110
- puts "Saved link."
111
- else
112
- configuration.links.delete(options)
113
- configuration.save
114
- puts "Deleted link."
115
- end
107
+ configuration.links.add(options)
108
+ configuration.save
109
+ puts "Saved link."
110
+ end
111
+
112
+ def unlink(key)
113
+ configuration.links.delete(key)
114
+ configuration.save
115
+ puts "Deleted link."
116
116
  end
117
117
 
118
- def sync
119
- configuration.links.each do |config|
118
+ def sync(match)
119
+ configuration.links.each do |index, config|
120
+ next if match && match != index
120
121
  excluded = configuration.shortcuts.generate(config.marshal_dump)
121
122
  excluded_output(excluded)
122
123
  end
data/lib/aka/upgrader.rb CHANGED
@@ -1,22 +1,46 @@
1
1
  module Aka
2
2
  module Upgrader
3
- module FromV0
3
+ module FromV0ToV1
4
4
  def self.run(aka_yml)
5
5
  v0 = YAML::load_file(aka_yml)
6
6
 
7
7
  current = {
8
- :version => Aka::Configuration::FORMAT,
8
+ :version => '1',
9
9
  :shortcuts => v0
10
10
  }
11
11
 
12
12
  FileUtils.cp(aka_yml, "#{aka_yml}.backup")
13
+ puts "Backed up to #{aka_yml}.backup."
13
14
 
14
15
  File.open(aka_yml, 'w+') do |f|
15
16
  f.write current.to_yaml
16
17
  end
17
-
18
18
  puts "Upgraded #{aka_yml}."
19
+ end
20
+ end
21
+
22
+ module FromV1ToV2
23
+ def self.run(aka_yml)
24
+ v1 = YAML::load_file(aka_yml)
25
+
26
+ v2 = v1.merge(:version => '2')
27
+ links = v2.delete(:links)
28
+ v2[:links] = new_links = {}
29
+ if links
30
+ index = 0
31
+ links.each do |element|
32
+ index += 1
33
+ new_links[index] = element
34
+ end
35
+ end
36
+
37
+ FileUtils.cp(aka_yml, "#{aka_yml}.backup")
19
38
  puts "Backed up to #{aka_yml}.backup."
39
+
40
+ File.open(aka_yml, 'w+') do |f|
41
+ f.write v2.to_yaml
42
+ end
43
+ puts "Upgraded #{aka_yml}."
20
44
  end
21
45
  end
22
46
  end
data/lib/aka/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aka
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/man/aka-link.1.ronn CHANGED
@@ -4,8 +4,8 @@ aka-link(1) -- Link keyboard shortcuts
4
4
  ## SYNOPSIS
5
5
 
6
6
  `aka link` [`-t` <tag1>[,<tag2>...]]
7
- [`-o` <output>]
8
- [`--delete`]
7
+ [`-o` <output>]<br>
8
+ `aka link` `delete` *link*
9
9
 
10
10
  ## DESCRIPTION
11
11
 
@@ -21,19 +21,27 @@ After creating a link, you can easily synchronize changes to shortcuts to design
21
21
  * `-o <output>`:
22
22
  The location to link the output to.
23
23
 
24
- * `--delete`:
25
- Delete the link with the given options.
24
+ * `delete` *link*:
25
+ Delete the link with id *link*.
26
26
 
27
27
  ## EXAMPLES
28
28
 
29
29
  Add a link:
30
30
 
31
- $ aka link --tag os:linux --output ~/.aka.zsh
31
+ $ aka link --tag os:linux --output \~/.aka.zsh
32
32
  Saved link.
33
33
 
34
34
  Remove a link:
35
35
 
36
- $ aka link --delete --tag os:linux --output ~/.aka.zsh
36
+ $ aka list
37
+ ...
38
+ =====
39
+ Links
40
+ =====
41
+
42
+ [1] ~/.aka.zsh: #osx, #git
43
+ [2] ~/.aka.zsh: #linux, #git
44
+ $ aka link delete 2
37
45
  Removed link.
38
46
 
39
47
  ## SEE ALSO
data/man/aka-sync.1.ronn CHANGED
@@ -3,7 +3,7 @@ aka-sync(1) -- Synchronize keyboard shortcuts
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `aka sync`
6
+ `aka sync` <link>
7
7
 
8
8
  ## DESCRIPTION
9
9
 
@@ -11,6 +11,11 @@ This command manages synchronizes keyboard shortcuts links in `aka(7)`.
11
11
 
12
12
  Any links you've created will be generated to the designated `output` with the given `tags`.
13
13
 
14
+ ## OPTIONS
15
+
16
+ * `<link>`:
17
+ Provide the id of a specific link to synchronize.
18
+
14
19
  ## EXAMPLES
15
20
 
16
21
  Synchronize links:
@@ -23,4 +28,4 @@ Synchronize links:
23
28
 
24
29
  ## SEE ALSO
25
30
 
26
- `aka(7)`, `aka-link(1)`
31
+ `aka(7)`, `aka-link(1)`, `aka-list(1)`
data/man/aka.7.ronn CHANGED
@@ -10,7 +10,8 @@ aka(7) -- Manage Shell Keyboard Shortcuts
10
10
  `aka` list \[options\]<br>
11
11
  `aka` link \[options\]<br>
12
12
  `aka` generate \[options\]<br>
13
- `aka` sync
13
+ `aka` sync<br>
14
+ `aka` upgrade
14
15
 
15
16
  ## DESCRIPTION
16
17
 
@@ -88,7 +89,15 @@ Add a link:
88
89
 
89
90
  Remove a link:
90
91
 
91
- $ aka link --delete --tag os:linux --output ~/.aka.zsh
92
+ $ aka list
93
+ ...
94
+ =====
95
+ Links
96
+ =====
97
+
98
+ [1] ~/.aka.zsh: #osx, #git
99
+ [2] ~/.aka.zsh: #linux, #git
100
+ $ aka link delete 2
92
101
  Removed link.
93
102
 
94
103
  Synchronize links:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hsume2-aka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Hsu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-27 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.0.3
186
+ rubygems_version: 2.0.14
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Manage Shell Keyboard Shortcuts