cmd_tools 4.1.4 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -0
- data/bin/command/bak +2 -0
- data/bin/command/e +16 -0
- data/bin/command/em +11 -0
- data/bin/command/emacs_stop +2 -0
- data/bin/command/tsh +2 -0
- data/bin/command/uncomment +2 -0
- data/lib/cmd_tools/application.rb +8 -0
- data/lib/cmd_tools/commands/min_max.rb +12 -0
- data/lib/cmd_tools/recommended_shell_settings.rb +1 -21
- data/lib/cmd_tools/version.rb +1 -1
- data/test/helper_for_test.rb +7 -0
- data/test/test_commands.rb +12 -0
- metadata +24 -15
data/Rakefile
ADDED
data/bin/command/bak
ADDED
data/bin/command/e
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
files="$@"
|
4
|
+
case $(uname) in
|
5
|
+
# emacs_launch do not work satisfactory on Mac.
|
6
|
+
"Darwin")
|
7
|
+
for file in ${files}
|
8
|
+
do
|
9
|
+
[ -e ${file} ] || touch ${file}
|
10
|
+
done
|
11
|
+
open -a /Applications/MacPorts/Emacs.app ${files}
|
12
|
+
;;
|
13
|
+
*)
|
14
|
+
cmd_tools emacs_launch --mode=gui ${files}
|
15
|
+
;;
|
16
|
+
esac
|
data/bin/command/em
ADDED
data/bin/command/tsh
ADDED
@@ -4,6 +4,14 @@ class ::CmdTools::Application < Thor
|
|
4
4
|
require 'ruby_patch'
|
5
5
|
extend ::RubyPatch::AutoLoad
|
6
6
|
|
7
|
+
desc "min_max < FILE", "Return the minmum and maximum value of each column."
|
8
|
+
method_option :min_max_separator, default: "\t", aliases: "-m"
|
9
|
+
method_option :field_separator, default: "\t", aliases: "-f"
|
10
|
+
def min_max()
|
11
|
+
puts ::CmdTools::Commands::MinMax.run($stdin.read, options[:min_max_separator])\
|
12
|
+
.join(options[:field_separator])
|
13
|
+
end
|
14
|
+
|
7
15
|
desc "backup FILE1 FILE2 ...", "Backup files and directories."
|
8
16
|
def backup(*files)
|
9
17
|
puts ::CmdTools::Commands::Backup.run(*files).join("\t")
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ::CmdTools::Commands::MinMax
|
2
|
+
require 'ruby_patch'
|
3
|
+
extend ::RubyPatch::AutoLoad
|
4
|
+
|
5
|
+
def self.run(str, min_max_separator = "\t")
|
6
|
+
str.split("\n")\
|
7
|
+
.map{|l| l.split.map{|field| field.to_f}}\
|
8
|
+
.transpose\
|
9
|
+
.map(&:minmax)\
|
10
|
+
.map{|min_max| min_max.join(min_max_separator)}
|
11
|
+
end
|
12
|
+
end
|
@@ -1,26 +1,6 @@
|
|
1
1
|
module CmdTools
|
2
2
|
RECOMMENDED_SHELL_SETTINGS = <<-EOS
|
3
3
|
# CmdTools
|
4
|
-
|
5
|
-
alias tsh='cmd_tools trash'
|
6
|
-
alias emacs_stop='cmd_tools emacs_stop'
|
7
|
-
case $(uname) in
|
8
|
-
# emacs_launch do not work satisfactory on Mac.
|
9
|
-
"Darwin")
|
10
|
-
function e(){
|
11
|
-
files="$@"
|
12
|
-
for file in ${files}
|
13
|
-
do
|
14
|
-
[ -e ${file} ] || touch ${file}
|
15
|
-
done
|
16
|
-
open -a /Applications/MacPorts/Emacs.app ${files}
|
17
|
-
}
|
18
|
-
alias em='/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs --no-window-system --no-init-file'
|
19
|
-
;;
|
20
|
-
*)
|
21
|
-
alias e='cmd_tools emacs_launch --mode=gui'
|
22
|
-
alias em='cmd_tools emacs_launch --mode=cui'
|
23
|
-
;;
|
24
|
-
esac
|
4
|
+
export PATH=${HOME}/.gem/ruby/1.9.1/gems/cmd_tools-#{CmdTools::VERSION}/bin/command:${PATH}
|
25
5
|
EOS
|
26
6
|
end
|
data/lib/cmd_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmd_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby_patch
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152489040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152489040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152487640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0.16'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152487640
|
36
36
|
description: ! 'Command line tools. Please type
|
37
37
|
|
38
38
|
|
@@ -49,28 +49,37 @@ extensions: []
|
|
49
49
|
extra_rdoc_files: []
|
50
50
|
files:
|
51
51
|
- README.rdoc
|
52
|
+
- Rakefile
|
52
53
|
- bin/cmd_tools
|
54
|
+
- bin/command/bak
|
55
|
+
- bin/command/e
|
56
|
+
- bin/command/em
|
57
|
+
- bin/command/emacs_stop
|
58
|
+
- bin/command/tsh
|
59
|
+
- bin/command/uncomment
|
53
60
|
- cmd_tools.gemspec
|
54
61
|
- lib/cmd_tools.rb
|
55
62
|
- lib/cmd_tools/application.rb
|
56
63
|
- lib/cmd_tools/commands.rb
|
57
64
|
- lib/cmd_tools/commands/backup.rb
|
58
65
|
- lib/cmd_tools/commands/emacs_launch.rb
|
66
|
+
- lib/cmd_tools/commands/min_max.rb
|
59
67
|
- lib/cmd_tools/commands/trash.rb
|
60
68
|
- lib/cmd_tools/config.rb
|
61
69
|
- lib/cmd_tools/recommended_shell_settings.rb
|
62
70
|
- lib/cmd_tools/version.rb
|
71
|
+
- test/helper_for_test.rb
|
72
|
+
- test/test_commands.rb
|
63
73
|
homepage:
|
64
74
|
licenses: []
|
65
|
-
post_install_message: !
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
\ ;;\nesac\n\n"
|
75
|
+
post_install_message: ! '
|
76
|
+
|
77
|
+
# CmdTools
|
78
|
+
|
79
|
+
export PATH=${HOME}/.gem/ruby/1.9.1/gems/cmd_tools-4.2.0/bin/command:${PATH}
|
80
|
+
|
81
|
+
|
82
|
+
'
|
74
83
|
rdoc_options: []
|
75
84
|
require_paths:
|
76
85
|
- lib
|