co 0.1.0 → 0.1.1
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/README.md +2 -2
- data/bin/co +13 -2
- data/lib/co/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 134a65a89d55b058e2520491a1e23bad571807e2
|
4
|
+
data.tar.gz: 8c2526cdeb3ef37de38d3cc32b4f705c4711743b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8578b081cfd654e7eef1160743a811e80a47c19ad12c0b5c67185a43334e0d1bf7b49e2ca82806b304bbdaab793d72d74510930a90087d357a1796d393495b04
|
7
|
+
data.tar.gz: 5291b807cf0b094c092f0dc91362e50d4cc1477b41bdd11875b676fc1ec0ebe18f66a6c6e382f2a3aa6db1f2143cad29d871a6e1a94eb9b7a3f7918f7895bb08
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ IMPORTANT:
|
|
52
52
|
|
53
53
|
You need to include the following export into your bash profile.
|
54
54
|
|
55
|
-
|
55
|
+
export PROMPT_COMMAND="history -a;"$PROMPT_COMMAND
|
56
56
|
|
57
57
|
After this bash will sync your history file on every command.
|
58
58
|
Without it, co will save the last command of your previous session every time.
|
@@ -101,7 +101,7 @@ In this config file, you may specify a custom location for a database as a key v
|
|
101
101
|
|
102
102
|
## Contributing
|
103
103
|
|
104
|
-
1. Fork it ( https://github.com/
|
104
|
+
1. Fork it ( https://github.com/0catac0/co/fork )
|
105
105
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
106
106
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
107
107
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/bin/co
CHANGED
@@ -45,8 +45,10 @@ if(ARGV[0] == 'save')
|
|
45
45
|
|
46
46
|
cmd = `tail -n 1 ${HOME}/.bash_history`
|
47
47
|
cmd.strip!
|
48
|
+
cmd.gsub!("\'","\'\'")
|
48
49
|
|
49
50
|
description = options[:description]
|
51
|
+
description.gsub!("\'","\'\'") unless description == nil
|
50
52
|
|
51
53
|
#treat any tokens that start with @ as tags
|
52
54
|
tags = []
|
@@ -60,7 +62,8 @@ if(ARGV[0] == 'save')
|
|
60
62
|
#insert stuff into the database
|
61
63
|
begin
|
62
64
|
#find or insert command
|
63
|
-
db.execute
|
65
|
+
db.execute("INSERT OR IGNORE INTO commands(cmd,description) VALUES ('#{cmd}','#{description}');")
|
66
|
+
|
64
67
|
cmd_id = db.get_first_value "SELECT id from commands WHERE cmd = '#{cmd}';"
|
65
68
|
|
66
69
|
tags.each do |tag|
|
@@ -79,8 +82,16 @@ if(ARGV[0] == 'save')
|
|
79
82
|
exit #quit
|
80
83
|
end
|
81
84
|
|
85
|
+
#select all commands
|
86
|
+
if(ARGV[0] == 'list' && ARGV[1] == 'all')
|
87
|
+
rows = db.execute "SELECT * from commands"
|
88
|
+
for row in rows do
|
89
|
+
puts row.join "\s | \s"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
82
93
|
#select all commands in current pwd
|
83
|
-
if(ARGV[0] == 'list')
|
94
|
+
if(ARGV[0] == 'list' && ARGV[1] != 'all')
|
84
95
|
tag = "@#{pwd}"
|
85
96
|
if(ARGV[1] != nil && ARGV[1].start_with?("@"))
|
86
97
|
tag = ARGV[1]
|
data/lib/co/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: co
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0catac0
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|