hsume2-aka 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +8 -0
  6. data/Guardfile +9 -0
  7. data/LICENSE.txt +7 -0
  8. data/README.md +91 -0
  9. data/Rakefile +98 -0
  10. data/aka.gemspec +28 -0
  11. data/bin/aka +5 -0
  12. data/features/aka/add.feature +183 -0
  13. data/features/aka/edit.feature +91 -0
  14. data/features/aka/generate.feature +117 -0
  15. data/features/aka/help.feature +80 -0
  16. data/features/aka/list.feature +62 -0
  17. data/features/aka/remove.feature +48 -0
  18. data/features/aka/show.feature +38 -0
  19. data/features/step_definitions/aka_steps.rb +3 -0
  20. data/features/support/env.rb +80 -0
  21. data/lib/aka/app.rb +66 -0
  22. data/lib/aka/man/aka-add.1 +34 -0
  23. data/lib/aka/man/aka-add.1.txt +31 -0
  24. data/lib/aka/man/aka-edit.1 +96 -0
  25. data/lib/aka/man/aka-edit.1.txt +75 -0
  26. data/lib/aka/man/aka-generate.1 +81 -0
  27. data/lib/aka/man/aka-generate.1.txt +70 -0
  28. data/lib/aka/man/aka-list.1 +71 -0
  29. data/lib/aka/man/aka-list.1.txt +63 -0
  30. data/lib/aka/man/aka-remove.1 +30 -0
  31. data/lib/aka/man/aka-remove.1.txt +29 -0
  32. data/lib/aka/man/aka-show.1 +33 -0
  33. data/lib/aka/man/aka-show.1.txt +31 -0
  34. data/lib/aka/man/aka.7 +169 -0
  35. data/lib/aka/man/aka.7.txt +121 -0
  36. data/lib/aka/store.rb +372 -0
  37. data/lib/aka/version.rb +3 -0
  38. data/lib/aka.rb +6 -0
  39. data/man/aka-add.1.ronn +32 -0
  40. data/man/aka-edit.1.ronn +67 -0
  41. data/man/aka-generate.1.ronn +51 -0
  42. data/man/aka-list.1.ronn +51 -0
  43. data/man/aka-remove.1.ronn +21 -0
  44. data/man/aka-show.1.ronn +27 -0
  45. data/man/aka.7.ronn +85 -0
  46. data/test/tc_something.rb +7 -0
  47. metadata +184 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3369794f383200ea13fef6e746ac0c58b9f1f248
4
+ data.tar.gz: 835091cbc77b20d99c2ad3b2957d204884fae358
5
+ SHA512:
6
+ metadata.gz: 87d76091861f959ff6deba94453faf3e8d6af4e24b256c022ec57eb4ebcc952d5dd4bf5aad166c239ea16c5b15820ece7d7809f5f181cb1337344164810ec2d0
7
+ data.tar.gz: 77964a52a87358e29a1d13e18fa212c5512732cd3b372d449cc3234bb737d29da0573d1d1d589d58afc313d65f8303e7fe47caf9045bce608386d4b4b1d8ae10
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .DS_Store
2
+ results.html
3
+ pkg
4
+ html
5
+ tmp
6
+ Gemfile.lock
7
+ .bundle
8
+
9
+ # output from ronn
10
+ lib/aka/man/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p247
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ bundler_args: --without guard
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :guard do
6
+ gem 'guard'
7
+ gem 'guard-cucumber'
8
+ end
data/Guardfile ADDED
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'cucumber', :cli => '--no-profile --color --format progress --strict --tags ~@interactive' do
5
+ watch(%r{^lib/.+\.rb$})
6
+ watch(%r{^features/.+\.feature$})
7
+ watch(%r{^features/support/.+$}) { 'features' }
8
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2014 YOUR NAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,91 @@
1
+ aka(7) -- Manage Shell Keyboard Shortcuts
2
+ =========================================
3
+
4
+ [![Build Status](https://travis-ci.org/hsume2/aka.png?branch=master)](https://travis-ci.org/hsume2/aka)
5
+
6
+ ## SYNOPSIS
7
+
8
+ `aka` add <shortcut> <command> \[options\]<br>
9
+ `aka` show <shortcut> \[options\]<br>
10
+ `aka` edit <shortcut> \[options\]<br>
11
+ `aka` remove <shortcut><br>
12
+ `aka` list \[options\]<br>
13
+ `aka` generate \[options\]
14
+
15
+ ## DESCRIPTION
16
+
17
+ **aka** is an easy way to manage keyboard shortcuts in UNIX shells.
18
+
19
+ You can replace commonly used commands with shorter, sexier keyboard shortcuts and, ultimately, improve your productivity!
20
+
21
+ 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
+
23
+ ## INSTALLATION
24
+
25
+ $ gem install aka
26
+
27
+ ## OPTIONS
28
+
29
+ * `--help`:<br>
30
+ Show help info
31
+
32
+ * `--version`:<br>
33
+ Show version info
34
+
35
+ * `--log-level=<debug|info|warn|error|fatal>`:<br>
36
+ Set the logging level (Default: info)
37
+
38
+ ## EXAMPLES
39
+
40
+ Add a keyboard shortcut and generate the output script:
41
+
42
+ $ aka add ls "ls -F --color=auto"
43
+ Created shortcut.
44
+ $ aka generate
45
+ alias ls="ls -F --color=auto"
46
+
47
+ Add a keyboard shortcut for a bash/zsh function:
48
+
49
+ $ aka add psf "ps aux | grep $@" --function
50
+ Created shortcut.
51
+ $ aka generate
52
+ function psf {
53
+ ps aux | grep $@
54
+ }
55
+
56
+ Generate to a file instead:
57
+
58
+ $ aka generate -o ~/.aka.zsh
59
+ Generated ~/.aka.zsh.
60
+
61
+ Tag a shortcut and generate for OS X:
62
+
63
+ $ aka add ls "ls -F --color=auto" --tag os:linux
64
+ Created shortcut.
65
+ $ aka add ls "ls -FG" --tag os:darwin
66
+ Created shortcut.
67
+ $ aka generate --tag os:darwin
68
+ alias ls="ls -FG"
69
+
70
+ Edit a shortcut:
71
+
72
+ $ aka edit ls "ls -F --color=auto" --tag os:linux
73
+ 1 Shortcut: ls
74
+ 2 Description:
75
+ 3
76
+ 4 Function (y/n): n
77
+ 5 Tags: os:linux
78
+ 6 Command:
79
+ 7 ls -FG
80
+ /var/folders/rj/8bjyj6x92l9bxykxc_ljyqsc0000gp/T/shortcut20140222-63006-13csxr0" 7L, 87C
81
+ $ :wq
82
+
83
+ Remove a shortcut:
84
+
85
+ $ aka remove ls
86
+ Removes shortcut.
87
+
88
+ ## ENVIRONMENT
89
+
90
+ * `AKA`:<br>
91
+ The file where **aka** stores everything. Default: ~/.aka.yml
data/Rakefile ADDED
@@ -0,0 +1,98 @@
1
+ def dump_load_path
2
+ puts $LOAD_PATH.join("\n")
3
+ found = nil
4
+ $LOAD_PATH.each do |path|
5
+ if File.exists?(File.join(path,"rspec"))
6
+ puts "Found rspec in #{path}"
7
+ if File.exists?(File.join(path,"rspec","core"))
8
+ puts "Found core"
9
+ if File.exists?(File.join(path,"rspec","core","rake_task"))
10
+ puts "Found rake_task"
11
+ found = path
12
+ else
13
+ puts "!! no rake_task"
14
+ end
15
+ else
16
+ puts "!!! no core"
17
+ end
18
+ end
19
+ end
20
+ if found.nil?
21
+ puts "Didn't find rspec/core/rake_task anywhere"
22
+ else
23
+ puts "Found in #{path}"
24
+ end
25
+ end
26
+ require 'bundler'
27
+ require 'rake/clean'
28
+
29
+ require 'rake/testtask'
30
+
31
+ require 'cucumber'
32
+ require 'cucumber/rake/task'
33
+ gem 'rdoc' # we need the installed RDoc gem, not the system one
34
+ require 'rdoc/task'
35
+
36
+ include Rake::DSL
37
+
38
+ Bundler::GemHelper.install_tasks
39
+
40
+
41
+ Rake::TestTask.new do |t|
42
+ t.pattern = 'test/tc_*.rb'
43
+ end
44
+
45
+
46
+ CUKE_RESULTS = 'results.html'
47
+ CLEAN << CUKE_RESULTS
48
+ Cucumber::Rake::Task.new(:features) do |t|
49
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x --tags ~@interactive"
50
+ t.fork = false
51
+ end
52
+
53
+ Rake::RDocTask.new do |rd|
54
+
55
+ rd.main = "README.rdoc"
56
+
57
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
58
+ end
59
+
60
+ begin
61
+ require 'ronn'
62
+
63
+ namespace :man do
64
+ directory "lib/aka/man"
65
+
66
+ Dir["man/*.ronn"].each do |ronn|
67
+ basename = File.basename(ronn, ".ronn")
68
+ roff = "lib/aka/man/#{basename}"
69
+
70
+ file roff => ["lib/aka/man", ronn] do
71
+ sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}"
72
+ end
73
+
74
+ file "#{roff}.txt" => roff do
75
+ sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
76
+ end
77
+
78
+ task :build_all_pages => "#{roff}.txt"
79
+ end
80
+
81
+ desc "Build the man pages"
82
+ task :build => "man:build_all_pages"
83
+
84
+ desc "Clean up from the built man pages"
85
+ task :clean do
86
+ rm_rf "lib/aka/man"
87
+ end
88
+ end
89
+
90
+ rescue LoadError
91
+ namespace :man do
92
+ task(:build) { abort "Install the ronn gem to be able to release!" }
93
+ task(:clean) { abort "Install the ronn gem to be able to release!" }
94
+ end
95
+ end
96
+
97
+ task :default => ["man:build", :test, :features]
98
+
data/aka.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aka/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hsume2-aka"
8
+ spec.version = Aka::VERSION
9
+ spec.authors = ["Henry Hsu"]
10
+ spec.email = ["hhsu@zendesk.com"]
11
+ spec.summary = %q{Manage Shell Keyboard Shortcuts}
12
+ spec.description = %q{Manage Shell Keyboard Shortcuts}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.files += Dir.glob('lib/aka/man/**/*') # man/ is ignored by git
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency("bundler", "~> 1.5")
23
+ spec.add_development_dependency('rake', '~> 0.9.2')
24
+ spec.add_development_dependency('rdoc')
25
+ spec.add_development_dependency('aruba')
26
+ spec.add_development_dependency('ronn')
27
+ spec.add_dependency('methadone', '~> 1.3.1')
28
+ end
data/bin/aka ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'aka.rb'
4
+
5
+ Aka::App.go!
@@ -0,0 +1,183 @@
1
+ Feature: Add keyboard shortcuts
2
+ In order to improve productivity
3
+ I want to have a tool for managing 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: Create new shortcut
15
+ When I run `aka add ls "ls -F --color=auto"`
16
+ Then the exit status should be 0
17
+ And the output should contain:
18
+ """
19
+ Created shortcut.
20
+ """
21
+ And the file ".aka.yml" should contain exactly:
22
+ """
23
+ ---
24
+ 1: !ruby/object:OpenStruct
25
+ table:
26
+ :shortcut: ls
27
+ :command: ls -F --color=auto
28
+ modifiable: true
29
+
30
+ """
31
+
32
+ Scenario: Create new shortcut with tag
33
+ When I run `aka add ls "ls -F --color=auto" -t os:darwin`
34
+ Then the exit status should be 0
35
+ And the output should contain:
36
+ """
37
+ Created shortcut.
38
+ """
39
+ And the file ".aka.yml" should contain exactly:
40
+ """
41
+ ---
42
+ 1: !ruby/object:OpenStruct
43
+ table:
44
+ :shortcut: ls
45
+ :command: ls -F --color=auto
46
+ :tag:
47
+ - os:darwin
48
+ modifiable: true
49
+
50
+ """
51
+
52
+ Scenario: Create new shortcut with multiple tags
53
+ When I run `aka add ls "ls -F --color=auto" -t A,B`
54
+ Then the exit status should be 0
55
+ And the output should contain:
56
+ """
57
+ Created shortcut.
58
+ """
59
+ And the file ".aka.yml" should contain exactly:
60
+ """
61
+ ---
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
70
+
71
+ """
72
+
73
+ Scenario: Create new shortcut with new tag
74
+ Given I run `aka add ls "ls -FG" -t A,B`
75
+ When I run `aka add ls "ls -FG" -t C`
76
+ Then the exit status should be 0
77
+ And the output should contain:
78
+ """
79
+ Created shortcut.
80
+ """
81
+ And the file ".aka.yml" should contain exactly:
82
+ """
83
+ ---
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
99
+
100
+ """
101
+
102
+ Scenario: Don't overwrite existing shortcut
103
+ Given I run `aka add ls "ls -F --color=auto"`
104
+ When I run `aka add ls "ls -FG"`
105
+ Then the exit status should not be 0
106
+ And the output should contain exactly:
107
+ """
108
+ Created shortcut.
109
+ Shortcut "ls" exists. Pass --force to overwrite. Or provide a new --tag.
110
+
111
+ """
112
+ And the file ".aka.yml" should contain exactly:
113
+ """
114
+ ---
115
+ 1: !ruby/object:OpenStruct
116
+ table:
117
+ :shortcut: ls
118
+ :command: ls -F --color=auto
119
+ modifiable: true
120
+
121
+ """
122
+
123
+ Scenario: Overwrite existing shortcut with force
124
+ Given I run `aka add ls "ls -F --color=auto"`
125
+ When I run `aka add ls "ls -FG" -f`
126
+ Then the exit status should be 0
127
+ And the output should contain exactly:
128
+ """
129
+ Created shortcut.
130
+ Overwrote shortcut.
131
+
132
+ """
133
+ And the file ".aka.yml" should contain exactly:
134
+ """
135
+ ---
136
+ 1: !ruby/object:OpenStruct
137
+ table:
138
+ :shortcut: ls
139
+ :command: ls -FG
140
+ modifiable: true
141
+
142
+ """
143
+
144
+ Scenario: Create new shortcut as function
145
+ When I run `aka add ls "ls -F --color=auto" --function`
146
+ Then the exit status should be 0
147
+ And the output should contain:
148
+ """
149
+ Created shortcut.
150
+ """
151
+ And the file ".aka.yml" should contain exactly:
152
+ """
153
+ ---
154
+ 1: !ruby/object:OpenStruct
155
+ table:
156
+ :shortcut: ls
157
+ :command: ls -F --color=auto
158
+ :function: true
159
+ modifiable: true
160
+
161
+ """
162
+
163
+ Scenario: Create new shortcut with description
164
+ When I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls"`
165
+ Then the exit status should be 0
166
+ And the output should contain:
167
+ """
168
+ Created shortcut.
169
+ """
170
+ And the file ".aka.yml" should contain exactly:
171
+ """
172
+ ---
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
182
+
183
+ """
@@ -0,0 +1,91 @@
1
+ Feature: Edit keyboard shortcuts
2
+ In order to improve productivity
3
+ I want to have a tool for managing 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
+ Scenario: Edit
14
+ Given I run `aka add ls "ls -F --color=auto"`
15
+ And a file named "input.txt" with:
16
+ """
17
+ Shortcut: lsf
18
+ Description:
19
+ 1
20
+ 2
21
+ 3
22
+ Function (y/n): y
23
+ Tags: zsh, bash
24
+ Command:
25
+ ls -F
26
+ """
27
+ When I run `aka edit ls -i input.txt`
28
+ Then the exit status should be 0
29
+ And the output should contain exactly:
30
+ """
31
+ Created shortcut.
32
+ Saved shortcut.
33
+
34
+ """
35
+ And the file ".aka.yml" should contain exactly:
36
+ """
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
51
+
52
+ """
53
+
54
+ @interactive
55
+ Scenario: Edit interactively
56
+ Given I run `aka add ls "ls -F --color=auto"`
57
+ When I run `aka edit ls` interactively
58
+ Then the exit status should be 0
59
+ And the output should contain exactly:
60
+ """
61
+ Created shortcut.
62
+ Saved shortcut.
63
+
64
+ """
65
+ And the file ".aka.yml" should contain exactly:
66
+ """
67
+ ---
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
81
+
82
+ """
83
+
84
+ Scenario: Edit: Missing shortcut
85
+ When I run `aka edit ls`
86
+ Then the exit status should not be 0
87
+ And the output should contain exactly:
88
+ """
89
+ Shortcut not found.
90
+
91
+ """
@@ -0,0 +1,117 @@
1
+ Feature: Generate commands for loading keyboard shortcuts into your shell
2
+ In order to improve productivity
3
+ I want to have a tool for managing 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
+ Scenario: Generate script to file
14
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
15
+ And I run `aka add ls "ls -FG" --tag os:darwin`
16
+ And I run `aka add .. "cd .."`
17
+ When I run `aka generate --output .aka.zsh`
18
+ Then the exit status should be 0
19
+ And the output should contain exactly:
20
+ """
21
+ Created shortcut.
22
+ Created shortcut.
23
+ Created shortcut.
24
+ Generated .aka.zsh.
25
+
26
+ """
27
+ And the file ".aka.zsh" should contain exactly:
28
+ """
29
+ alias ..="cd .."
30
+ alias ls="ls -FG"
31
+ function ls {
32
+ ls -F --color=auto
33
+ }
34
+
35
+ """
36
+
37
+ Scenario: Generate script to stdout
38
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
39
+ And I run `aka add ls "ls -FG" --tag os:darwin`
40
+ And I run `aka add .. "cd .."`
41
+ When I run `aka generate`
42
+ Then the exit status should be 0
43
+ And the output should contain exactly:
44
+ """
45
+ Created shortcut.
46
+ Created shortcut.
47
+ Created shortcut.
48
+ alias ..="cd .."
49
+ alias ls="ls -FG"
50
+ function ls {
51
+ ls -F --color=auto
52
+ }
53
+
54
+ """
55
+
56
+ Scenario: Generate script matching tag
57
+ Given I run `aka add ls "ls -F --color=auto" --description "ls\nls\nls" --function --tag os:linux`
58
+ And I run `aka add ls "ls -FG" --tag os:darwin`
59
+ And I run `aka add .. "cd .."`
60
+ When I run `aka generate --tag os:darwin`
61
+ Then the exit status should be 0
62
+ And the stdout should contain exactly:
63
+ """
64
+ Created shortcut.
65
+ Created shortcut.
66
+ Created shortcut.
67
+ alias ..="cd .."
68
+ alias ls="ls -FG"
69
+
70
+ """
71
+ And the stderr should contain exactly:
72
+ """
73
+ 1 shortcut(s) excluded (#os:linux).
74
+
75
+ """
76
+
77
+ Scenario: Generate script with function
78
+ Given I run `aka add ls "ls -F --color=auto" --function`
79
+ When I run `aka generate --output .aka2.zsh`
80
+ Then the exit status should be 0
81
+ And the output should contain exactly:
82
+ """
83
+ Created shortcut.
84
+ Generated .aka2.zsh.
85
+
86
+ """
87
+ And the file ".aka2.zsh" should contain exactly:
88
+ """
89
+ function ls {
90
+ ls -F --color=auto
91
+ }
92
+
93
+ """
94
+
95
+ Scenario: Generate script shortcuts before functions
96
+ Given I run `aka add ls "ls -F --color=auto" --function`
97
+ And I run `aka add sc "script/console"`
98
+ And I run `aka add sg "script/generate"`
99
+ When I run `aka generate --output .aka.zsh`
100
+ Then the exit status should be 0
101
+ And the output should contain exactly:
102
+ """
103
+ Created shortcut.
104
+ Created shortcut.
105
+ Created shortcut.
106
+ Generated .aka.zsh.
107
+
108
+ """
109
+ And the file ".aka.zsh" should contain exactly:
110
+ """
111
+ alias sc="script/console"
112
+ alias sg="script/generate"
113
+ function ls {
114
+ ls -F --color=auto
115
+ }
116
+
117
+ """