op5util 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e98f6586637c365b530e61bfbe8f093810f91c4a
4
- data.tar.gz: af78260122910360c4b002a63517e741cdd5dfb1
3
+ metadata.gz: 633eb23a8f27b8e4fec8a2b91346245798125cb0
4
+ data.tar.gz: 96e215bea0d1036f0a0d5b6e9708477e02bcb167
5
5
  SHA512:
6
- metadata.gz: 299a69cdfc4641c84eacbe55fda165b818e3d89fe164b07542c10d8767c9e52cbc7098a50fabd208e4872d56a492a740f29d3b5e6c00d345593b7b22eb5f9f01
7
- data.tar.gz: ec5d9537d086bf34e302e063000806cb138a26919ea91b587ae502cf71a3c152163f80c9a203983bb67e7156129179f3a1398db8eeeaf6b84f16174454577f48
6
+ metadata.gz: 876545c14290ab04a7983d407ef1d538681b7a688bb2a59cdf77e0e646ce96a2ad9e2c5481dbbce50523677800961443108c2daa4127fff78701074535167b5b
7
+ data.tar.gz: 50dbac952a698fb8067550eeb4d8fd4118dd5ea3eb8af68dba63c5dbe57edd69395be0c8e11e8d3a61050138bed2cb752dbe84a94c7421ecf9eb966f8bfc88bf
data/Readme.md CHANGED
@@ -60,7 +60,7 @@ with the terminal output by op5util.
60
60
 
61
61
  ### Another use case
62
62
 
63
- Op5util is installed using ```gem install pkg/0.1.0.pkg```
63
+ Op5util is installed using ```gem install op5util```
64
64
 
65
65
  The export of the environment variable MONITOR is to avoid using the command-line
66
66
  flag ```-m monitor.ipa.hemma``` on every command, and by saving credentials in the in the .op5pass
@@ -92,14 +92,14 @@ and the other gems that op5util depends on.
92
92
  user@host:~$ sudo gem install op5util
93
93
  ```
94
94
 
95
- Latest version is 0.1.3, you can verify that op5util is installed correctly with:
95
+ Latest version is 0.1.5, you can verify that op5util is installed correctly with:
96
96
 
97
97
  ``` shell
98
98
  user@host:~$ gem list --details op5util
99
99
 
100
100
  *** LOCAL GEMS ***
101
101
 
102
- op5util (0.1.3)
102
+ op5util (0.1.5)
103
103
  Author: Niklas Paulsson
104
104
  Homepage: https://github.com/np422/Op5util
105
105
  License: MIT License
@@ -139,7 +139,7 @@ SYNOPSIS
139
139
  op5util [global options] command [command options] [arguments...]
140
140
 
141
141
  VERSION
142
- 0.1.3
142
+ 0.1.5
143
143
 
144
144
  GLOBAL OPTIONS
145
145
  -f, --authfile=authfile - Authfile containing "username:password" used to authenticate with Op5
@@ -160,6 +160,7 @@ COMMANDS
160
160
  lasts until host/service recovery.
161
161
  add - Add a new host to be monitored by the Op5 server
162
162
  add_hostgroups - Add host to a new hostgroup(s)
163
+ autocomplete - Show instruction on howto setup tab autocomplete for op5util in your shell
163
164
  downtime - Schedule fixed downtime for a host
164
165
  help - Shows a list of commands or help for one command
165
166
  hostgroups - List hostgroups, optionally with member and service info, Usage examples:
@@ -212,6 +213,14 @@ free to leave a bug-reports or feature requests as an issue in this repo.
212
213
 
213
214
  ## Version history
214
215
 
216
+ ### 0.1.5
217
+
218
+ Added template for shell autocomplete of op5util command (bash/zsh)
219
+
220
+ ### 0.1.4
221
+
222
+ Gemspec filespec corrected to avoid unnecessary large .gem-files.
223
+
215
224
  ### 0.1.3
216
225
 
217
226
  Environment variable OP5AUTHFILE possible to use instead of --authfile, check permission
data/bin/op5util CHANGED
@@ -156,6 +156,13 @@ command :hostgroups do |c|
156
156
  end
157
157
  end
158
158
 
159
+ desc 'Show instruction on howto setup tab autocomplete for op5util in your shell'
160
+ command :autocomplete do |c|
161
+ c.action do
162
+ monitor.autocomplete
163
+ end
164
+ end
165
+
159
166
  pre do |global, _command, _options, _args|
160
167
  global[:authfile] = ENV['OP5AUTHFILE'] if !ENV['OP5AUTHFILE'].nil? && (global[:authfile] == '~/.op5pass')
161
168
  Op5util.check_auth(global) ? true : false
@@ -0,0 +1,59 @@
1
+ # rubocop:disable LineLength, MethodLength, AccessorMethodName
2
+ # Foo
3
+ module Op5util
4
+ # Foo
5
+ class Monitor
6
+ def autocomplete
7
+ s = '
8
+ # Add this to suitable shell startup file to get tab autocomplete for op5util.
9
+ # op5util autocomplete >> ~/.bashrc
10
+ # ZSH-users should uncomment the line below
11
+ # autoload -U +X bashcompinit && bashcompinit
12
+
13
+ _op5util()
14
+ {
15
+ local cur prev opts base
16
+ COMPREPLY=()
17
+ cur="${COMP_WORDS[COMP_CWORD]}"
18
+ op5command="${COMP_WORDS[1]}"
19
+ opts="acknowledge add add_hostgroups downtime help hostgroups schedule status"
20
+
21
+ case "${op5command}" in
22
+ acknowledge)
23
+ COMPREPLY=( $(compgen -W "-c --comment=Work_in_Progress -p --persistent --no-persistent -v --verbose --no-verbose SOME_OP5_HOST" -- ${cur}) )
24
+ ;;
25
+ add)
26
+ COMPREPLY=( $(compgen -W "-a --alias=\" -c --contactgroups=\" -g --hostgroups=\" -i --ipaddr=\" HOST_TO_ADD" -- ${cur}) )
27
+ ;;
28
+ add_hostgroups)
29
+ COMPREPLY=( $(compgen -W "-g --hostgroup= SOME_OP5_HOST" -- ${cur}) )
30
+ ;;
31
+ autocomplete)
32
+ COMPREPLY=( $(compgen -W "ENTER" -- ${cur}) )
33
+ ;;
34
+ downtime)
35
+ COMPREPLY=( $(compgen -W "-t --time=n_hour_duration_of_downtime -w --wait=n_hours_before_downtime_start -c --comment= SOME_OP5_HOST" -- ${cur}) )
36
+ ;;
37
+ hostgroups)
38
+ COMPREPLY=( $(compgen -W "-l --long SOME_OP5_HOSTGROUP" -- ${cur}) )
39
+ ;;
40
+ schedule)
41
+ COMPREPLY=( $(compgen -W "-v --verbose SOME_OP5_HOST" -- ${cur}) )
42
+ ;;
43
+ status)
44
+ COMPREPLY=( $(compgen -W "-l --long -s --short SOME_OP5_HOST" -- ${cur}) )
45
+ ;;
46
+ *)
47
+ ;;
48
+ esac
49
+ if [ -z $COMPREPLY ]; then
50
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
51
+ fi
52
+ return 0
53
+ }
54
+ complete -F _op5util op5util
55
+ '
56
+ puts s
57
+ end
58
+ end
59
+ end
@@ -1,3 +1,3 @@
1
1
  module Op5util
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
data/lib/op5util.rb CHANGED
@@ -9,3 +9,4 @@ require 'op5util/status_summary.rb'
9
9
  require 'op5util/acknowledge_alarm.rb'
10
10
  require 'op5util/list_hostgroups.rb'
11
11
  require 'op5util/schedule_checks.rb'
12
+ require 'op5util/autocomplete.rb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: op5util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niklas Paulsson
@@ -125,6 +125,7 @@ files:
125
125
  - lib/op5util/acknowledge_alarm.rb
126
126
  - lib/op5util/add_host.rb
127
127
  - lib/op5util/add_hostgroups.rb
128
+ - lib/op5util/autocomplete.rb
128
129
  - lib/op5util/check_auth.rb
129
130
  - lib/op5util/list_hostgroups.rb
130
131
  - lib/op5util/method_template.rb