aka2 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -1
- data/changelog.md +5 -0
- data/lib/aka.rb +42 -37
- data/lib/aka/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 786de0de3b83d830707958649eefe21a15ea2170
|
4
|
+
data.tar.gz: b96dee6dba6635ce7246a7df16a79527f2f377b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227a648cf372eaf4f8cc5c8318538883f150572212caf46484605bfc6b673972eb9ae6b02357aa904da18fc15d395aa45e40d241bb7503ab59075246fa804bf9
|
7
|
+
data.tar.gz: 99cfb490b8e746df54e169ca41b508182ce3c4abe3407b4eba43fb0fde0215c104f3445b4feebb4ebaca52e47161903336da7619274dd22ebac4397cb5c8c1ea
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,8 +7,12 @@ aka2 requires ruby and is built for bash and zsh users.
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
$ gem install aka2
|
10
|
-
$ aka
|
10
|
+
$ aka setup
|
11
11
|
|
12
|
+
If you wish to reinstall aka setup
|
13
|
+
|
14
|
+
$ aka setup --reset
|
15
|
+
|
12
16
|
## Usage
|
13
17
|
|
14
18
|
$ aka generate hello="echo helloworld"
|
data/changelog.md
CHANGED
data/lib/aka.rb
CHANGED
@@ -130,27 +130,32 @@ module Aka
|
|
130
130
|
#
|
131
131
|
# SETUP
|
132
132
|
#
|
133
|
-
desc "
|
133
|
+
desc "setup_old", "setup aka"
|
134
134
|
method_options :force => :boolean
|
135
|
-
def
|
136
|
-
|
135
|
+
def setup_old
|
136
|
+
setup_aka_old
|
137
137
|
end
|
138
138
|
|
139
139
|
#
|
140
140
|
# first step: set config file
|
141
141
|
#
|
142
|
-
desc "
|
143
|
-
method_options :
|
144
|
-
def
|
142
|
+
desc "setup", "Gem - Setup aka"
|
143
|
+
method_options :reset => :boolean
|
144
|
+
def setup
|
145
145
|
configDir = "#{Dir.home}/.aka"
|
146
|
+
if options.reset? && File.exist?("#{configDir}")
|
147
|
+
FileUtils.rm_r("#{configDir}")
|
148
|
+
puts "#{configDir} is removed"
|
149
|
+
end
|
150
|
+
|
146
151
|
if File.exist?("#{configDir}/.config")
|
147
|
-
#
|
148
|
-
puts "
|
152
|
+
puts ".aka config file is exist in #{configDir}"
|
153
|
+
puts "Please run [aka setup --reset] to remove aka file and setup again"
|
149
154
|
else
|
150
|
-
setup_config
|
151
|
-
#
|
152
|
-
|
153
|
-
|
155
|
+
setup_config # create and setup .config file
|
156
|
+
setup_aka # put value in .config file
|
157
|
+
setup_autosource # create, link source file
|
158
|
+
puts "Congratulation, aka is setup in #{configDir}"
|
154
159
|
end
|
155
160
|
end
|
156
161
|
|
@@ -217,14 +222,14 @@ module Aka
|
|
217
222
|
#
|
218
223
|
# LIST OUT
|
219
224
|
#
|
220
|
-
desc "
|
225
|
+
desc "list_old", "list alias (short alias: l)"
|
221
226
|
method_options :force => :boolean
|
222
|
-
def
|
227
|
+
def list_old(args=nil)
|
223
228
|
if args != nil
|
224
|
-
|
229
|
+
showlast_old(args.to_i)
|
225
230
|
else
|
226
231
|
value = readYML("#{Dir.home}/.aka/.config")["list"]
|
227
|
-
|
232
|
+
showlast_old(value.to_i) #this is unsafe
|
228
233
|
end
|
229
234
|
|
230
235
|
#total of #{} exports #functions
|
@@ -235,14 +240,14 @@ module Aka
|
|
235
240
|
#
|
236
241
|
# LIST OUT - ryan - remove numbering
|
237
242
|
#
|
238
|
-
desc "
|
243
|
+
desc "list", "list alias (short alias: l)"
|
239
244
|
method_options :force => :boolean
|
240
|
-
def
|
245
|
+
def list(args=nil)
|
241
246
|
if args != nil
|
242
|
-
|
247
|
+
showlast(args.to_i)
|
243
248
|
else
|
244
249
|
value = readYML("#{Dir.home}/.aka/.config")["list"]
|
245
|
-
|
250
|
+
showlast(value.to_i) #this is unsafe
|
246
251
|
end
|
247
252
|
|
248
253
|
#total of #{} exports #functions
|
@@ -254,10 +259,10 @@ module Aka
|
|
254
259
|
#
|
255
260
|
# USAGE
|
256
261
|
#
|
257
|
-
desc "
|
262
|
+
desc "usage_old [number]", "show commands usage based on history"
|
258
263
|
# method_options :least, :type => :boolean, :aliases => '-l', :desc => 'show the least used commands'
|
259
264
|
# method_options :clear, :type => :boolean, :aliases => '-c', :desc => 'clear the dot history file'
|
260
|
-
def
|
265
|
+
def usage_old(args=nil)
|
261
266
|
if args
|
262
267
|
if options.least
|
263
268
|
showUsage(args.to_i, true) if args
|
@@ -267,10 +272,10 @@ module Aka
|
|
267
272
|
else
|
268
273
|
if options.least
|
269
274
|
value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
270
|
-
|
275
|
+
showlast_old(value.to_i, true) #this is unsafe
|
271
276
|
else
|
272
277
|
value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
273
|
-
|
278
|
+
showlast_old(value.to_i) #this is unsafe
|
274
279
|
end
|
275
280
|
end
|
276
281
|
|
@@ -280,12 +285,12 @@ module Aka
|
|
280
285
|
end
|
281
286
|
|
282
287
|
#
|
283
|
-
#
|
288
|
+
# USAGE - ryan - remove numbering in front
|
284
289
|
#
|
285
|
-
desc "
|
290
|
+
desc "usage [number]", "show commands usage based on history"
|
286
291
|
# method_options :least, :type => :boolean, :aliases => '-l', :desc => 'show the least used commands'
|
287
292
|
# method_options :clear, :type => :boolean, :aliases => '-c', :desc => 'clear the dot history file'
|
288
|
-
def
|
293
|
+
def usage(args=nil)
|
289
294
|
if args
|
290
295
|
if options.least
|
291
296
|
showUsage(args.to_i, true) if args
|
@@ -295,10 +300,10 @@ module Aka
|
|
295
300
|
else
|
296
301
|
if options.least
|
297
302
|
value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
298
|
-
|
303
|
+
showlast(value.to_i, true) #this is unsafe
|
299
304
|
else
|
300
305
|
value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
301
|
-
|
306
|
+
showlast(value.to_i) #this is unsafe
|
302
307
|
end
|
303
308
|
end
|
304
309
|
|
@@ -682,8 +687,8 @@ module Aka
|
|
682
687
|
end
|
683
688
|
end
|
684
689
|
|
685
|
-
#
|
686
|
-
def
|
690
|
+
# setup_aka_old
|
691
|
+
def setup_aka_old
|
687
692
|
append_with_newline("export HISTSIZE=10000","/etc/profile")
|
688
693
|
trap = "sigusr2() { unalias $1;}
|
689
694
|
sigusr1() { source #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}; history -a; echo 'reloaded dot file'; }
|
@@ -693,8 +698,8 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
|
693
698
|
puts "Done. Please restart this shell.".red
|
694
699
|
end
|
695
700
|
|
696
|
-
#
|
697
|
-
def
|
701
|
+
# setup_aka_old2 by ryan - check bash file first
|
702
|
+
def setup_aka_old2
|
698
703
|
if File.exist?("#{Dir.home}/.zshrc") #if zshec exist
|
699
704
|
setZSHRC2
|
700
705
|
append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.zshrc")
|
@@ -718,8 +723,8 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
|
718
723
|
puts "Done. Please restart this shell.".red
|
719
724
|
end
|
720
725
|
|
721
|
-
#
|
722
|
-
def
|
726
|
+
# setup_aka by ryan - set value in config file
|
727
|
+
def setup_aka
|
723
728
|
if File.exist?("#{Dir.home}/.zshrc") #if zshec exist
|
724
729
|
setZSHRC2
|
725
730
|
elsif File.exist?("#{Dir.home}/.bashrc") #if bashrc exist
|
@@ -819,7 +824,7 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
|
819
824
|
end
|
820
825
|
|
821
826
|
# show last
|
822
|
-
def
|
827
|
+
def showlast_old howmany=10
|
823
828
|
str = checkConfigFile(readYML("#{Dir.home}/.aka/.config")["dotfile"])
|
824
829
|
|
825
830
|
if content = File.open(str).read
|
@@ -852,7 +857,7 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
|
852
857
|
end
|
853
858
|
|
854
859
|
# show last2 - ryan - remove number
|
855
|
-
def
|
860
|
+
def showlast howmany=10
|
856
861
|
str = checkConfigFile(readYML("#{Dir.home}/.aka/.config")["dotfile"])
|
857
862
|
|
858
863
|
if content = File.open(str).read
|
data/lib/aka/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aka2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Lim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-08-
|
12
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-scp
|
@@ -137,7 +137,6 @@ files:
|
|
137
137
|
- README.md
|
138
138
|
- Rakefile
|
139
139
|
- aka.gemspec
|
140
|
-
- aka2-0.1.0.gem
|
141
140
|
- bin/aka
|
142
141
|
- bin/console
|
143
142
|
- bin/setup
|