tasc 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 +8 -8
- data/README.md +6 -7
- data/lib/tasc/list.rb +3 -2
- data/lib/tasc/show.rb +1 -1
- data/lib/tasc/update.rb +5 -5
- data/lib/tasc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjQzYjFjODU1MzhmMmU1N2FlMTIzZGIwNmY5MjA0YTEyYzUyNjZiMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2VmN2IxMDFmOTYxZjQ3ODQ2MDhjODgyNmFiMzVhYTcwZjcyOTc3Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDU2MjdmODIxZmYyZGZhMzI3YTA3ZDhlMTY3ZGI1MGRjMDYyMTNlZmFhMTlk
|
10
|
+
NzBkZWJkN2RjNjE4NzQyNzk5OTNjNWNjOWIyNDEzZjc3ZjI1YzliMTNiZjc3
|
11
|
+
MmE3ODFkMDEzYmIxMzllMDA5NzQ4ZGRjMWVlZDBmYTU2Yjk3NTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDFhOTdlZDBkZDAxYWM3YmE5ZTVhM2JiYjIyNWJlYjNhMDQ4NTIxYjFhMzRj
|
14
|
+
NTI5OTlkNDEwNDZlZjJhZjcwZmQ3MmUxNmVhYjM1ZWMyYWQ5OWY2NGFmYWRi
|
15
|
+
OTI5YjE0NTI4NTMwMDAxNzUyYTAyOWU4NjU5NDE5NjdkYWZmNzE=
|
data/README.md
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# tasc CLI
|
2
|
-
tasc
|
3
|
-
lists of terms that are available for auto-complete
|
4
|
-
|
5
|
-
tasc is a ruby gem built on top of the gli (aka, "git-like interface")
|
6
|
-
library.
|
2
|
+
tasc (TrieService auto-suggest command-line interface) is a CLI for maintaining and managing the
|
3
|
+
lists of terms that are available for auto-complete.
|
7
4
|
|
8
5
|
### Installing
|
6
|
+
|
9
7
|
$ gem install tasc
|
10
8
|
|
11
9
|
Alternatively, clone this repo and execute the following commands from within this
|
12
10
|
directory
|
11
|
+
|
13
12
|
$ rake
|
14
13
|
$ gem install tasc
|
15
14
|
|
@@ -21,7 +20,7 @@ started. To see all available commands simply type
|
|
21
20
|
|
22
21
|
#### Client Configuration
|
23
22
|
tasc will create a configuration file of servers you may connect to in
|
24
|
-
your user directory under _
|
23
|
+
your user directory under _~/.tasc/servers.yaml_. You can use the _config_
|
25
24
|
command to display your current config settings or alter them.
|
26
25
|
|
27
26
|
$ tasc config
|
@@ -52,7 +51,7 @@ Supports 2 types of lists:
|
|
52
51
|
Dynamic lists are self-maintaining. The TrieService keeps track of each
|
53
52
|
entry's usage and age. You can configure a maximum number of entries
|
54
53
|
that will be maintained. When the max size is reached, the usage and age is used to sort
|
55
|
-
the list and remove the least-
|
54
|
+
the list and remove the least-frequently used item (LFU).
|
56
55
|
|
57
56
|
### Building
|
58
57
|
|
data/lib/tasc/list.rb
CHANGED
@@ -11,8 +11,9 @@ command :list do |c|
|
|
11
11
|
if resp.code == '200'
|
12
12
|
puts "List of Labels:"
|
13
13
|
entries = JSON resp.body
|
14
|
-
entries.sort
|
15
|
-
|
14
|
+
entries.keys.sort.each { |k| entries[k] = entries.delete k }
|
15
|
+
entries.each do |e|
|
16
|
+
puts " #{e[0]}:#{e[1]}"
|
16
17
|
end
|
17
18
|
else
|
18
19
|
ap "Server Error: #{resp.code} - #{resp.message}"
|
data/lib/tasc/show.rb
CHANGED
@@ -11,7 +11,7 @@ command :show do |c|
|
|
11
11
|
if resp.code == '200'
|
12
12
|
entries = JSON resp.body
|
13
13
|
puts "Entries from #{name}:"
|
14
|
-
puts Hirb::Helpers::Table.render entries, :headers=>["Key", "Value", "Weight"]
|
14
|
+
puts Hirb::Helpers::Table.render entries, :headers=>["Key", "Value", "Weight", "Display"]
|
15
15
|
elsif resp.code == '202'
|
16
16
|
puts "List '#{name}' too long to display"
|
17
17
|
elsif resp.code == '204'
|
data/lib/tasc/update.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
desc 'Updates an existing value on an entity list. If the value does not exist, it will be added.'
|
2
|
-
long_desc '[name] [key] [value] [rank] are all required; e.g., tasc update state massachusetts MA 1'
|
2
|
+
long_desc '[name] [key] [value] [rank] [display] are all required; e.g., tasc update state massachusetts MA 1 Massachusetts'
|
3
3
|
|
4
4
|
command :update do |c|
|
5
5
|
c.action do |global_options,options,args|
|
6
6
|
|
7
7
|
ap "Executing update command ..."
|
8
|
-
if (args[0] == nil) || (args[1] == nil) || (args[2] == nil) || (args[3] == nil)
|
8
|
+
if (args[0] == nil) || (args[1] == nil) || (args[2] == nil) || (args[3] == nil) || (args[4] == nil)
|
9
9
|
help_now! "Missing required arguments to update command."
|
10
10
|
else
|
11
|
-
if (args.length >
|
11
|
+
if (args.length > 5)
|
12
12
|
help_now! "Too many arguments given."
|
13
13
|
else
|
14
|
-
uristr = "http://#{$host}/typeahead/update?entity=#{args[0]}&key=#{args[1]}&value=#{args[2]}&rank=#{args[3]}"
|
14
|
+
uristr = "http://#{$host}/typeahead/update?entity=#{args[0]}&key=#{args[1]}&value=#{args[2]}&rank=#{args[3]}&display=#{args[4]}"
|
15
15
|
uri = URI(uristr)
|
16
16
|
resp = Net::HTTP.get_response(uri)
|
17
17
|
if (resp.code == '200')
|
18
|
-
ap "Added #{args[1]} to #{args[0]} with value #{args[2]} rank #{args[3]}"
|
18
|
+
ap "Added #{args[1]} to #{args[0]} with value #{args[2]} rank #{args[3]} display #{args[4]}"
|
19
19
|
else
|
20
20
|
ap "Server Error: #{resp.code} - #{resp.message}"
|
21
21
|
ap "URI: #{uristr}"
|
data/lib/tasc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tasc
|
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
|
- Steve Quince
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.0.
|
179
|
+
rubygems_version: 2.0.3
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: TrieService Auto-Suggest Command-Line Client for managing term lists
|