hcl 0.4.15 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b075deba585be93e48ef66396c6c847d6b7bf0e0
4
- data.tar.gz: 646e8e506006258deaee88748a40820f40d69bbc
3
+ metadata.gz: 59531588b87aa600b30ee0f3e6325cf4d3ee2528
4
+ data.tar.gz: 2e3776a004591899b1f54738aadaa270caa7bd6c
5
5
  SHA512:
6
- metadata.gz: 8694e4acad5a4af641c724d7851ef559b032b097567790bd3d5fcb53cff394969dbcbb3886342036866aa2f310fcf66b0374ce3a6f3deb803956a43175137e7a
7
- data.tar.gz: b0d1da651a3bb4e4688dfc664371a74aacab0a5d3b17a75e5e51d4c779032dd9fdbde652d0dc01cc3f80f4539496651e44f15eed962dbc1f7c4b0e8e1bae1dcc
6
+ metadata.gz: 0817b469cbfe8f933c38c3dfe12da7ce89e234f84c0931cf2b3c94109738a219fcc67cad0d87c205f47363b5a72851ec5ec5de1400da9fed00462155a4f852b2
7
+ data.tar.gz: bdc62476627578256de28356ac8370d8bce1b02d797c9917d4c4a79f226bf59db1c715da59ae7aca43299866af02abfcb699f633b0ad4e04b6e435d3ee5f1196
@@ -1,5 +1,11 @@
1
1
  # Recent Changes in HCl
2
2
 
3
+ ## v0.4.16 2017-02-12
4
+
5
+ * improved bash completion (from chet0xhenry)
6
+ * fix deprecated `respond_to?` impls, closes #72 (charneykaye)
7
+ * fix manpage installation, closes #75 (thanks to lukehatfield)
8
+
3
9
  ## v0.4.15 2015-06-12
4
10
 
5
11
  * fix `status` command, closes #59
@@ -74,6 +74,15 @@ commands are equivalent:
74
74
 
75
75
  hcl @tacodev +0:15 Doing some stuff
76
76
  hcl +.25 @tacodev Doing some stuff
77
+
78
+ ### Getting the Current Status
79
+
80
+ The show command can give you a live view of your current day including
81
+ any running tasks, last note, and total time.
82
+
83
+ hcl show
84
+
85
+ Show can also be used with a variety of date formats. See [Date Formats](#date-formats) for more information
77
86
 
78
87
  ### Adding Notes to a Running Task
79
88
 
@@ -124,15 +133,12 @@ The above starts and immediately stops a one-hour timer with the given note.
124
133
 
125
134
  ## ADVANCED USAGE
126
135
 
127
- ### Bash Auto-completion of Task Aliases
128
-
129
- You can enable auto-completion of task aliases by adding this to your shell
130
- configuration (note the backticks inside the double quotes):
136
+ ### Bash Tab Completions
131
137
 
132
- complete -W "`cat ~/.hcl/aliases`" hcl
138
+ You can enable auto-completion of commands, project ids, task ids and task aliases by adding this to your shell
139
+ configuration:
133
140
 
134
- Warning: You will need to have run `hcl` at least once to create the aliases
135
- file. Without it, this command will fail with an error.
141
+ source $(ruby -e "print File.dirname(Gem.bin_path('hcl', 'hcl'))")/_hcl_completions
136
142
 
137
143
  ### Configuration Profiles
138
144
 
@@ -146,7 +152,7 @@ Here is a shell alias `myhcl` with a separate configuration from the
146
152
  main `hcl` command, and another command to configure alias completion:
147
153
 
148
154
  alias myhcl="env HCL_DIR=~/.myhcl hcl"
149
- complete -W "`cat ~/.myhcl/aliases`" myhcl
155
+ complete -F _hcl myhcl
150
156
 
151
157
  Adding something like the above to your bashrc will enable a new command,
152
158
  `myhcl`. When using `myhcl` you can use different credentials and aliases,
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ task :update_bundle do
6
6
  system("bundle")
7
7
  system("git ci -am 'update gemfile.lock'")
8
8
  end
9
- task :release => :update_bundle
9
+ task :release => [:update_bundle]
10
10
 
11
11
  require 'fileutils'
12
12
  task :clean do
@@ -22,7 +22,7 @@ task :default => :test
22
22
 
23
23
  # process the README into a manual page using ronn
24
24
  require 'ronn'
25
- task :man do
25
+ task 'man/hcl.1' do
26
26
  print "Writing manual page..."
27
27
  head, content = File.read('README.markdown').split("## SYNOPSIS\n")
28
28
  content.prepend <<-END
@@ -33,12 +33,12 @@ hcl(1) -- Track time with Harvest time sheets
33
33
  END
34
34
  FileUtils.mkdir_p('man')
35
35
  File.write('man/hcl.1.ronn', content)
36
- File.open('man/hcl.1','w').tap do |man|
36
+ File.open('man/hcl.1','w') do |man|
37
37
  man.write Ronn::Document.new('man/hcl.1.ronn').to_roff
38
38
  end
39
39
  puts "done."
40
40
  end
41
- task "pkg/hcl-#{HCl::VERSION}.gem" => :man
41
+ task :build => 'man/hcl.1'
42
42
 
43
43
  require 'yard'
44
44
  YARD::Rake::YardocTask.new
@@ -0,0 +1,67 @@
1
+ #!/bin/bash
2
+
3
+ _hcl_getProjects()
4
+ {
5
+ $1 tasks | perl -ne 's/ - (?!.* -).*//g; print;' | sed -e 's/\s[0-9]\+\s/ /g' | sed -e 's/\s/ /g' | sort | uniq
6
+ }
7
+
8
+ _hcl_getTasks()
9
+ {
10
+ $1 tasks | grep "^$2" | sed -e 's/\s/ /g' | sort | uniq | cut -d" " -f 2-
11
+ }
12
+
13
+ _hcl()
14
+ {
15
+ local count=${#COMP_WORDS[@]}
16
+ local script=${COMP_WORDS[0]}
17
+ local cur=${COMP_WORDS[COMP_CWORD]}
18
+ case $count in
19
+ 2)
20
+ COMPREPLY=( $(compgen -W "start resume log stop note show tasks alias unalias aliases cancel nvm oops config status" -- $cur) )
21
+ ;;
22
+ 3)
23
+ local namespace=${COMP_WORDS[1]}
24
+
25
+ case $namespace in
26
+ 'alias')
27
+ COMPREPLY=( $(compgen -W "" -- $cur) )
28
+ ;;
29
+ 'start'|'resume'|'log')
30
+ COMPREPLY=( $(compgen -W "$($script aliases | sed -e 's/,//g')" -- $cur) )
31
+ ;;
32
+ esac
33
+ ;;
34
+ 4)
35
+ local namespace=${COMP_WORDS[1]}
36
+ local task=${COMP_WORDS[2]}
37
+ case $namespace in
38
+ 'alias')
39
+ local IFS_OLD="$IFS";
40
+ local IFS=$'\n';
41
+ COMPREPLY=( $(compgen -W "$(_hcl_getProjects $script)" -- $cur) )
42
+ local IFS=$IFS_OLD;
43
+ if [[ ${#COMPREPLY[*]} -eq 1 ]]; then #Only one completion
44
+ COMPREPLY=$(echo $COMPREPLY | sed -e 's/\s.*$//g')
45
+ fi
46
+ ;;
47
+ esac
48
+ ;;
49
+ 5)
50
+ local namespace=${COMP_WORDS[1]}
51
+ local task=${COMP_WORDS[2]}
52
+ local projectid=${COMP_WORDS[3]}
53
+ case $namespace in
54
+ 'alias')
55
+ local IFS_OLD="$IFS";
56
+ local IFS=$'\n';
57
+ COMPREPLY=( $(compgen -W "$(_hcl_getTasks $script $projectid)" -- $cur) )
58
+ local IFS=$IFS_OLD;
59
+ if [[ ${#COMPREPLY[*]} -eq 1 ]]; then #Only one completion
60
+ COMPREPLY=$(echo $COMPREPLY | sed -e 's/\s.*$//g')
61
+ fi
62
+ ;;
63
+ esac
64
+ ;;
65
+ esac
66
+ }
67
+ complete -F _hcl hcl
@@ -48,9 +48,9 @@ module HCl
48
48
  if command? @command
49
49
  result = send @command, *@args
50
50
  if not result.nil?
51
- if result.respond_to? :join
51
+ if result.respond_to? :join, include_all=false
52
52
  puts result.join(', ')
53
- elsif result.respond_to? :to_s
53
+ elsif result.respond_to? :to_s, include_all=false
54
54
  puts result
55
55
  end
56
56
  end
@@ -12,7 +12,7 @@ module HCl
12
12
  @data.key?(method.to_sym) ? @data[method] : super
13
13
  end
14
14
 
15
- def respond_to? method
15
+ def respond_to? method, include_all=false
16
16
  (@data && @data.key?(method.to_sym)) || super
17
17
  end
18
18
 
@@ -1,3 +1,3 @@
1
1
  module HCl
2
- VERSION = '0.4.15'
2
+ VERSION = '0.4.16'
3
3
  end
data/man/hcl.1 CHANGED
@@ -0,0 +1,268 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "HCL" "1" "February 2017" "" ""
5
+ .
6
+ .SH "NAME"
7
+ \fBhcl\fR \- Track time with Harvest time sheets
8
+ .
9
+ .SH "SYNOPSIS"
10
+ .
11
+ .nf
12
+
13
+ hcl [start] @<task_alias> [+<time>] [<message>]
14
+ hcl note <message>
15
+ hcl stop [<message>]
16
+ hcl resume [@<task_alias>]
17
+ hcl log @<task_alias> [+<time>] [<message>]
18
+ hcl show [<date>]
19
+ hcl tasks [<project_code>]
20
+ hcl alias <task_alias> <project_id> <task_id>
21
+ hcl unalias <task_alias>
22
+ hcl aliases
23
+ hcl (cancel | nvm | oops)
24
+ hcl config
25
+ hcl status
26
+ .
27
+ .fi
28
+ .
29
+ .SH "DESCRIPTION"
30
+ .
31
+ .SS "Available Projects and Tasks"
32
+ To start a new timer you need to identify the project and task\. The tasks command displays a list of available tasks with their project and task IDs\.
33
+ .
34
+ .IP "" 4
35
+ .
36
+ .nf
37
+
38
+ hcl tasks
39
+ .
40
+ .fi
41
+ .
42
+ .IP "" 0
43
+ .
44
+ .P
45
+ You can also pass a project code (this is the short optional code associated with each project) to list only the tasks for that project\.
46
+ .
47
+ .SS "Starting a Timer"
48
+ Since it\'s not practical to enter two long numbers every time you want to identify a task, HCl supports task aliases:
49
+ .
50
+ .IP "" 4
51
+ .
52
+ .nf
53
+
54
+ hcl alias tacodev 1234 5678
55
+ hcl @tacodev Adding a new feature
56
+ .
57
+ .fi
58
+ .
59
+ .IP "" 0
60
+ .
61
+ .SS "Starting a Timer with Initial Time"
62
+ You can also provide an initial time when starting a new timer\. This can be expressed in floating\-point or HH:MM\. The following two commands are equivalent:
63
+ .
64
+ .IP "" 4
65
+ .
66
+ .nf
67
+
68
+ hcl @tacodev +0:15 Doing some stuff
69
+ hcl +\.25 @tacodev Doing some stuff
70
+ .
71
+ .fi
72
+ .
73
+ .IP "" 0
74
+ .
75
+ .SS "Getting the Current Status"
76
+ The show command can give you a live view of your current day including any running tasks, last note, and total time\.
77
+ .
78
+ .IP "" 4
79
+ .
80
+ .nf
81
+
82
+ hcl show
83
+ .
84
+ .fi
85
+ .
86
+ .IP "" 0
87
+ .
88
+ .P
89
+ Show can also be used with a variety of date formats\. See \fIDate Formats\fR for more information
90
+ .
91
+ .SS "Adding Notes to a Running Task"
92
+ While a task is running you can append lines to the task notes:
93
+ .
94
+ .IP "" 4
95
+ .
96
+ .nf
97
+
98
+ hcl note Then I did something else
99
+ .
100
+ .fi
101
+ .
102
+ .IP "" 0
103
+ .
104
+ .P
105
+ \fBNote\fR that \fBshow\fR only displays the last line of the timer notes\. You can list all the notes for a running timer by issuing the note command without any arguments:
106
+ .
107
+ .IP "" 4
108
+ .
109
+ .nf
110
+
111
+ hcl note
112
+ .
113
+ .fi
114
+ .
115
+ .IP "" 0
116
+ .
117
+ .SS "Stopping a Timer"
118
+ The following command will stop a running timer (currently only one timer at a time is supported)\. You can provide a message when stopping a timer as well:
119
+ .
120
+ .IP "" 4
121
+ .
122
+ .nf
123
+
124
+ hcl stop All done doing things
125
+ .
126
+ .fi
127
+ .
128
+ .IP "" 0
129
+ .
130
+ .SS "Resuming a Timer"
131
+ You can resume a stopped timer\. Specify a task to resume the last timer for that task:
132
+ .
133
+ .IP "" 4
134
+ .
135
+ .nf
136
+
137
+ hcl resume
138
+ hcl resume @xdev
139
+ .
140
+ .fi
141
+ .
142
+ .IP "" 0
143
+ .
144
+ .SS "Canceling a Timer"
145
+ If you accidentally started a timer that you didn\'t mean to, you can cancel it:
146
+ .
147
+ .IP "" 4
148
+ .
149
+ .nf
150
+
151
+ hcl cancel
152
+ .
153
+ .fi
154
+ .
155
+ .IP "" 0
156
+ .
157
+ .P
158
+ This will delete the running timer, or the last\-updated timer if one isn\'t running\. You can also use \fBnvm\fR or \fBoops\fR instead of \fBcancel\fR\.
159
+ .
160
+ .SS "Logging without Starting a Timer"
161
+ You can log time and notes without leaving a timer running\. It takes the same arguments as start:
162
+ .
163
+ .IP "" 4
164
+ .
165
+ .nf
166
+
167
+ hcl log @xdev +1 Worked for an hour\.
168
+ .
169
+ .fi
170
+ .
171
+ .IP "" 0
172
+ .
173
+ .P
174
+ The above starts and immediately stops a one\-hour timer with the given note\.
175
+ .
176
+ .SH "ADVANCED USAGE"
177
+ .
178
+ .SS "Bash Tab Completions"
179
+ You can enable auto\-completion of commands, project ids, task ids and task aliases by adding this to your shell configuration:
180
+ .
181
+ .IP "" 4
182
+ .
183
+ .nf
184
+
185
+ source $(ruby \-e "print File\.dirname(Gem\.bin_path(\'hcl\', \'hcl\'))")/_hcl_completions
186
+ .
187
+ .fi
188
+ .
189
+ .IP "" 0
190
+ .
191
+ .SS "Configuration Profiles"
192
+ You can modify your credentials with the \fB\-\-reauth\fR option, and review them with \fBhcl config\fR\. If you\'d rather store multiple configurations at once, specify an alternate configuration directory in the environment as \fBHCL_DIR\fR\. This can be used to interact with multiple harvest accounts at once\.
193
+ .
194
+ .P
195
+ Here is a shell alias \fBmyhcl\fR with a separate configuration from the main \fBhcl\fR command, and another command to configure alias completion:
196
+ .
197
+ .IP "" 4
198
+ .
199
+ .nf
200
+
201
+ alias myhcl="env HCL_DIR=~/\.myhcl hcl"
202
+ complete \-F _hcl myhcl
203
+ .
204
+ .fi
205
+ .
206
+ .IP "" 0
207
+ .
208
+ .P
209
+ Adding something like the above to your bashrc will enable a new command, \fBmyhcl\fR\. When using \fBmyhcl\fR you can use different credentials and aliases, while \fBhcl\fR will continue to function with your original configuration\.
210
+ .
211
+ .SS "Interactive Console"
212
+ An interactive Ruby console is provided to allow you to use the fairly powerful Harvest API client built into HCl, since not all of its features are exposed via the command line\. The current {HCl::App} instance is available as \fBhcl\fR\.
213
+ .
214
+ .P
215
+ It\'s also possible to issue HCl commands directly (except \fBalias\fR, see below), or to query specific JSON end points and have the results pretty\-printed:
216
+ .
217
+ .IP "" 4
218
+ .
219
+ .nf
220
+
221
+ hcl console
222
+ hcl> show "yesterday"
223
+ # => prints yesterday\'s timesheet, note the quotes!
224
+ hcl> hcl\.http\.get(\'daily\')
225
+ # => displays a pretty\-printed version of the JSON output
226
+ .
227
+ .fi
228
+ .
229
+ .IP "" 0
230
+ .
231
+ .P
232
+ Note that the HCl internals may change without notice\. Also, commands (like \fBalias\fR) that are also reserved words in Ruby can\'t be issued directly (use \fBsend :alias\fR instead)\.
233
+ .
234
+ .SS "Date Formats"
235
+ Dates can be expressed in a variety of ways\. See the Chronic documentation \fIhttp://chronic\.rubyforge\.org/\fR for more information about available date input formats\. The following commands show the time sheet for the specified day:
236
+ .
237
+ .IP "" 4
238
+ .
239
+ .nf
240
+
241
+ hcl show yesterday
242
+ hcl show last friday
243
+ hcl show 2 days ago
244
+ hcl show 1 week ago
245
+ .
246
+ .fi
247
+ .
248
+ .IP "" 0
249
+ .
250
+ .SS "Harvest service status"
251
+ Harvest provides a status API \fIhttp://harveststatus\.com\fR, which you can query using the \fBhcl status\fR command\. This will tell you whether Harvest itself is up, along with a timestamp of when it was last tested\.
252
+ .
253
+ .SH "AUTHOR"
254
+ HCl was designed and implemented by Zack Hobson \fIhttp://github\.com/zenhob\fR\.
255
+ .
256
+ .IP "\(bu" 4
257
+ Non\-SSL support by Michael Bleigh \fIhttp://github\.com/mbleigh\fR\.
258
+ .
259
+ .IP "\(bu" 4
260
+ Resume command by Brian Cooke \fIhttp://github\.com/bricooke\fR\.
261
+ .
262
+ .IP "\(bu" 4
263
+ UI improvements by Chris Scharf \fIhttp://github\.com/scharfie\fR\.
264
+ .
265
+ .IP "" 0
266
+ .
267
+ .P
268
+ See LICENSE for copyright details\.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hcl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zack Hobson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-13 00:00:00.000000000 Z
11
+ date: 2017-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem-man
@@ -219,6 +219,7 @@ files:
219
219
  - LICENSE
220
220
  - README.markdown
221
221
  - Rakefile
222
+ - bin/_hcl_completions
222
223
  - bin/hcl
223
224
  - lib/hcl.rb
224
225
  - lib/hcl/app.rb
@@ -261,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
262
  version: '0'
262
263
  requirements: []
263
264
  rubyforge_project:
264
- rubygems_version: 2.4.5
265
+ rubygems_version: 2.4.8
265
266
  signing_key:
266
267
  specification_version: 4
267
268
  summary: Harvest timesheets from the command-line