etcd-completion 0.0.1 → 0.0.2
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 +50 -22
- data/bin/etcd-completion +0 -7
- data/lib/etcd/completion/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 838c65b812cf27f31626684e15e71e7459c6d896
|
4
|
+
data.tar.gz: cee0dab9d704ae70f10f7ca1b0939381cd011579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a63fa945007f5c6b161801993ae49cddd31c0c4200d1df1d44945725a6bb1813a81d655a7880947dd63721e6b9f40ff6e8700034deb440601ebb3627d8ea2e0b
|
7
|
+
data.tar.gz: 38860b79acf047643e36aafd5b00b49cae64731c7dcbef7e0c409b8006c206cfd139477e5b031c4dc28cae6ec24996f21d4e4558606f93428acc58fa0825b832
|
data/README.md
CHANGED
@@ -1,29 +1,57 @@
|
|
1
1
|
# Etcd::Completion
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
2
|
+
Rubygem. Provides a CLI for performing etcd autocompletion.
|
4
3
|
|
5
4
|
## Installation
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
gem 'etcd-completion'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install etcd-completion
|
5
|
+
```bash
|
6
|
+
gem install etcd-completion
|
7
|
+
```
|
18
8
|
|
19
9
|
## Usage
|
10
|
+
```bash
|
11
|
+
etcd-completion <operation> <prefix>
|
12
|
+
```
|
13
|
+
Operation must an etcd operation - ie:
|
14
|
+
* mkdir
|
15
|
+
* get
|
16
|
+
* ls
|
17
|
+
* set
|
18
|
+
* etcetera
|
19
|
+
|
20
|
+
Prefix must be part of a path or a key.
|
21
|
+
|
22
|
+
## Examples
|
23
|
+
Given this directory structure:
|
24
|
+
```
|
25
|
+
/
|
26
|
+
|--dir1
|
27
|
+
| |--k/
|
28
|
+
| |--key
|
29
|
+
| |--key2
|
30
|
+
|--dir2
|
31
|
+
```
|
32
|
+
|
33
|
+
```
|
34
|
+
etcd-completion ls /d
|
35
|
+
--> /dir1/ /dir2/
|
36
|
+
|
37
|
+
etcd-completion ls /dir1
|
38
|
+
--> /dir1/key1 /dir1/key2
|
39
|
+
|
40
|
+
etcd-completion ls /dir1/k
|
41
|
+
--> /dir1/k/
|
42
|
+
|
43
|
+
etcd-completion get /dir1/k
|
44
|
+
--> /dir1/k/ /dir1/key /dir1/key2
|
45
|
+
```
|
46
|
+
|
47
|
+
## Limitations
|
48
|
+
* Currently, etcd-completion does not recurse into subdirectories to prune
|
49
|
+
invalid directories. In the above examples, the ```get /dir1/k``` example should
|
50
|
+
prune the "dir/k" directory, because there are no keys to "get" in that
|
51
|
+
directory, so get cannot possibly operate on a path starting with it. I plan
|
52
|
+
to address this problem in a future pull request.
|
53
|
+
* Currently, this gem is just a bin file, with no library, so it is useful
|
54
|
+
only from the commandline and not from ruby programs. I plan to rectify this
|
55
|
+
as well.
|
20
56
|
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Contributing
|
24
57
|
|
25
|
-
1. Fork it ( http://github.com/<my-github-username>/etcd-completion/fork )
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
data/bin/etcd-completion
CHANGED
@@ -13,14 +13,7 @@ def filter(prefix, key)
|
|
13
13
|
key.start_with?(prefix)
|
14
14
|
end
|
15
15
|
|
16
|
-
def log msg
|
17
|
-
open('/tmp/temp.txt', 'a') do |f|
|
18
|
-
f << msg << "\n"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
16
|
def completions(op, prefix)
|
23
|
-
log "op: #{op}, prefix:#{prefix}"
|
24
17
|
prefix = '' if prefix.nil?
|
25
18
|
if node_ops.include? op
|
26
19
|
type = 'node'
|