standup_md 0.3.16 → 0.3.17
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/Gemfile.lock +2 -2
- data/README.md +12 -0
- data/completion/zsh/_standup +80 -0
- data/lib/standup_md/cli/helpers.rb +11 -0
- data/lib/standup_md/cli.rb +65 -0
- data/lib/standup_md/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f155bb0cdeacfcf00716bfd5cfbc67a9e5d6d1d8be2b89c35d0f148ec782b264
|
|
4
|
+
data.tar.gz: fa9f7a3d971f45f79f2f819fcaa05c761bdf2cd3d9b4de3abc942b320ca4765d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b22a137af1ae2a03cead81ffce5b46f517721dd22f5364318e595ebe7e22d6b9eb7e2ed05021acaec9a3f5d0f76769c98d73a898ee908be58656c4d7f01a60f8
|
|
7
|
+
data.tar.gz: 5cbbf132c3cbec6e1b6290c1d1b13f8c7f8f25aa6b02d0e51052964b4688dcad7350488cc17810b1f87a9098bdcba21824e752c9fd7bbc71e21d3edeb86ab112
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
standup_md (0.3.
|
|
4
|
+
standup_md (0.3.17)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -115,7 +115,7 @@ CHECKSUMS
|
|
|
115
115
|
standard (1.54.0) sha256=7a4b08f83d9893083c8f03bc486f0feeb6a84d48233b40829c03ef4767ea0100
|
|
116
116
|
standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
|
|
117
117
|
standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
|
|
118
|
-
standup_md (0.3.
|
|
118
|
+
standup_md (0.3.17)
|
|
119
119
|
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
|
|
120
120
|
test-unit (3.7.8) sha256=689d1ca53f4d46f678b4e5d68d8e4294f87fc5e8b9238cc4de7c5727e8d65943
|
|
121
121
|
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
data/README.md
CHANGED
|
@@ -59,6 +59,17 @@ cd standup_md
|
|
|
59
59
|
rake install
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
### Zsh Completion
|
|
63
|
+
The gem ships with a zsh completion file at `completion/zsh/_standup`. RubyGems
|
|
64
|
+
doesn't automatically add gem-provided completion directories to zsh's `fpath`,
|
|
65
|
+
so you'll need to add the completion directory yourself after installation.
|
|
66
|
+
|
|
67
|
+
For setup instructions and example, run the following.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
standup --zsh-completion
|
|
71
|
+
```
|
|
72
|
+
|
|
62
73
|
## Usage
|
|
63
74
|
### Command Line
|
|
64
75
|
For the most basic usage, simply call the executable.
|
|
@@ -214,6 +225,7 @@ Some of these options can be changed at runtime. They are as follows.
|
|
|
214
225
|
-a --[no-]auto-fill-previous Auto-generate 'previous' tasks for new entries
|
|
215
226
|
-e --[no-]edit Open the file in the editor. Default is true
|
|
216
227
|
-v, --[no-]verbose Verbose output. Default is false.
|
|
228
|
+
--zsh-completion Print zsh completion setup instructions
|
|
217
229
|
-p, --print [DATE] Print current entry.
|
|
218
230
|
If DATE is passed, will print entry for DATE, if it exists.
|
|
219
231
|
DATE must be in the same format as file-name-format
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#compdef standup
|
|
2
|
+
|
|
3
|
+
_standup_array_values() {
|
|
4
|
+
_message -e values 'comma-separated list'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
_standup_sub_header_order() {
|
|
8
|
+
local -a headers
|
|
9
|
+
|
|
10
|
+
headers=(
|
|
11
|
+
'previous:previous entry tasks'
|
|
12
|
+
'current:current entry tasks'
|
|
13
|
+
'impediments:current entry impediments'
|
|
14
|
+
'notes:current entry notes'
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
_values -s , 'sub-header' $headers
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_standup_dates() {
|
|
21
|
+
local directory="${STANDUP_MD_DIR:-$HOME/.cache/standup_md}"
|
|
22
|
+
local index
|
|
23
|
+
local file
|
|
24
|
+
local -a dates
|
|
25
|
+
|
|
26
|
+
for (( index = 1; index <= $#words; index++ )); do
|
|
27
|
+
case "$words[index]" in
|
|
28
|
+
--directory=*)
|
|
29
|
+
directory="${words[index]#--directory=}"
|
|
30
|
+
;;
|
|
31
|
+
--directory|-d)
|
|
32
|
+
if (( index < $#words )); then
|
|
33
|
+
directory="$words[index + 1]"
|
|
34
|
+
fi
|
|
35
|
+
;;
|
|
36
|
+
esac
|
|
37
|
+
done
|
|
38
|
+
|
|
39
|
+
directory=${~directory}
|
|
40
|
+
if [[ -d "$directory" ]]; then
|
|
41
|
+
for file in "$directory"/*.md(N); do
|
|
42
|
+
file="${file:t:r}"
|
|
43
|
+
if [[ "$file" == <->_<-> ]]; then
|
|
44
|
+
dates+=("${file/_/-}:standup file ${file}.md")
|
|
45
|
+
fi
|
|
46
|
+
done
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
if (( ${#dates} )); then
|
|
50
|
+
_describe -t dates 'standup date' dates
|
|
51
|
+
else
|
|
52
|
+
_message -e dates 'date (YYYY-MM or YYYY-MM-DD)'
|
|
53
|
+
fi
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_arguments -s -S \
|
|
57
|
+
'(- *)'{-h,--help}'[show help]' \
|
|
58
|
+
'(- *)--version[show version]' \
|
|
59
|
+
'(- *)--zsh-completion[print zsh completion setup instructions]' \
|
|
60
|
+
'--current[List of current entry tasks]:tasks:_standup_array_values' \
|
|
61
|
+
'--previous[List of previous entry tasks]:tasks:_standup_array_values' \
|
|
62
|
+
'--impediments[List of impediments for current entry]:impediments:_standup_array_values' \
|
|
63
|
+
'--notes[List of notes for current entry]:notes:_standup_array_values' \
|
|
64
|
+
'--sub-header-order[The order of the sub-headers when writing the file]:sub-header order:_standup_sub_header_order' \
|
|
65
|
+
'(-f --file-name-format)-f[Date-formattable string to use for standup file name]:strftime format:' \
|
|
66
|
+
'(-f --file-name-format)--file-name-format[Date-formattable string to use for standup file name]:strftime format:' \
|
|
67
|
+
'(-E --editor)-E[Editor to use for opening standup files]:editor:_path_commands' \
|
|
68
|
+
'(-E --editor)--editor[Editor to use for opening standup files]:editor:_path_commands' \
|
|
69
|
+
'(-d --directory)-d[The directory where standup files are located]:directory:_directories' \
|
|
70
|
+
'(-d --directory)--directory[The directory where standup files are located]:directory:_directories' \
|
|
71
|
+
'(-w --write --no-write)'{-w,--write}'[write current entry if it does not exist]' \
|
|
72
|
+
'(-w --write --no-write)--no-write[do not write current entry if it does not exist]' \
|
|
73
|
+
'(-a --auto-fill-previous --no-auto-fill-previous)'{-a,--auto-fill-previous}'[auto-generate previous tasks for new entries]' \
|
|
74
|
+
'(-a --auto-fill-previous --no-auto-fill-previous)--no-auto-fill-previous[do not auto-generate previous tasks for new entries]' \
|
|
75
|
+
'(-e --edit --no-edit)'{-e,--edit}'[open the file in the editor]' \
|
|
76
|
+
'(-e --edit --no-edit)--no-edit[do not open the file in the editor]' \
|
|
77
|
+
'(-v --verbose --no-verbose)'{-v,--verbose}'[use verbose output]' \
|
|
78
|
+
'(-v --verbose --no-verbose)--no-verbose[disable verbose output]' \
|
|
79
|
+
'(-p --print)'{-p,--print}'[print current entry]::date:_standup_dates' \
|
|
80
|
+
'1:standup file date:_standup_dates'
|
|
@@ -104,6 +104,11 @@ module StandupMD
|
|
|
104
104
|
"Verbose output. Default is false."
|
|
105
105
|
) { |v| config.cli.verbose = v }
|
|
106
106
|
|
|
107
|
+
opts.on(
|
|
108
|
+
"--zsh-completion",
|
|
109
|
+
"Print zsh completion setup instructions"
|
|
110
|
+
) { @zsh_completion_requested = true }
|
|
111
|
+
|
|
107
112
|
opts.on(
|
|
108
113
|
"-p", "--print [DATE]",
|
|
109
114
|
"Print current entry.",
|
|
@@ -115,6 +120,12 @@ module StandupMD
|
|
|
115
120
|
v.nil? ? Date.today : Date.strptime(v, config.file.header_date_format)
|
|
116
121
|
end
|
|
117
122
|
end.parse!(options)
|
|
123
|
+
if zsh_completion_requested?
|
|
124
|
+
raise OptionParser::InvalidArgument, options.join(" ") unless options.empty?
|
|
125
|
+
|
|
126
|
+
return
|
|
127
|
+
end
|
|
128
|
+
|
|
118
129
|
unless options.empty?
|
|
119
130
|
@file_date_argument = true
|
|
120
131
|
config.cli.date = parse_file_date(options.shift)
|
data/lib/standup_md/cli.rb
CHANGED
|
@@ -9,6 +9,10 @@ module StandupMD
|
|
|
9
9
|
class Cli
|
|
10
10
|
include Helpers
|
|
11
11
|
|
|
12
|
+
ZSH_COMPLETION_FILE = ::File.expand_path(
|
|
13
|
+
::File.join(__dir__, "..", "..", "completion", "zsh", "_standup")
|
|
14
|
+
).freeze
|
|
15
|
+
|
|
12
16
|
##
|
|
13
17
|
# Access to the class's configuration.
|
|
14
18
|
#
|
|
@@ -25,10 +29,45 @@ module StandupMD
|
|
|
25
29
|
puts msg if config.verbose
|
|
26
30
|
end
|
|
27
31
|
|
|
32
|
+
##
|
|
33
|
+
# Prints zsh completion setup instructions.
|
|
34
|
+
#
|
|
35
|
+
# @return [String]
|
|
36
|
+
def self.zsh_completion_instructions
|
|
37
|
+
completion_dir = ::File.dirname(ZSH_COMPLETION_FILE)
|
|
38
|
+
|
|
39
|
+
<<~INSTRUCTIONS
|
|
40
|
+
Zsh completion file:
|
|
41
|
+
#{ZSH_COMPLETION_FILE}
|
|
42
|
+
|
|
43
|
+
To load it directly, add this before compinit runs:
|
|
44
|
+
|
|
45
|
+
fpath=("#{completion_dir}" $fpath)
|
|
46
|
+
autoload -Uz compinit
|
|
47
|
+
compinit
|
|
48
|
+
|
|
49
|
+
Or symlink it into your own completion directory:
|
|
50
|
+
|
|
51
|
+
mkdir -p ~/.zsh/completions
|
|
52
|
+
ln -sf "#{ZSH_COMPLETION_FILE}" ~/.zsh/completions/_standup
|
|
53
|
+
|
|
54
|
+
Then make sure that directory is in fpath before compinit runs:
|
|
55
|
+
|
|
56
|
+
fpath=(~/.zsh/completions $fpath)
|
|
57
|
+
autoload -Uz compinit
|
|
58
|
+
compinit
|
|
59
|
+
INSTRUCTIONS
|
|
60
|
+
end
|
|
61
|
+
|
|
28
62
|
##
|
|
29
63
|
# Creates an instance of +StandupMD+ and runs what the user requested.
|
|
30
64
|
def self.execute(options = [])
|
|
31
65
|
new(options).tap do |exe|
|
|
66
|
+
if exe.zsh_completion_requested?
|
|
67
|
+
puts zsh_completion_instructions
|
|
68
|
+
next
|
|
69
|
+
end
|
|
70
|
+
|
|
32
71
|
exe.write_file if exe.write?
|
|
33
72
|
if config.print
|
|
34
73
|
exe.print(exe.entry)
|
|
@@ -64,6 +103,14 @@ module StandupMD
|
|
|
64
103
|
@file_date_argument
|
|
65
104
|
end
|
|
66
105
|
|
|
106
|
+
##
|
|
107
|
+
# Was zsh completion output requested?
|
|
108
|
+
#
|
|
109
|
+
# @return [Boolean]
|
|
110
|
+
def zsh_completion_requested?
|
|
111
|
+
@zsh_completion_requested
|
|
112
|
+
end
|
|
113
|
+
|
|
67
114
|
##
|
|
68
115
|
# Constructor. Sets defaults.
|
|
69
116
|
#
|
|
@@ -72,9 +119,14 @@ module StandupMD
|
|
|
72
119
|
@config = self.class.config
|
|
73
120
|
@preference_file_loaded = false
|
|
74
121
|
@file_date_argument = false
|
|
122
|
+
@zsh_completion_requested = false
|
|
75
123
|
@options = options
|
|
124
|
+
return if load_zsh_completion_request(options)
|
|
125
|
+
|
|
76
126
|
load_preferences if load_config
|
|
77
127
|
load_runtime_preferences(options)
|
|
128
|
+
return if zsh_completion_requested?
|
|
129
|
+
|
|
78
130
|
@file = find_file
|
|
79
131
|
@file&.load
|
|
80
132
|
@entry = @file.nil? ? nil : new_entry(@file)
|
|
@@ -137,6 +189,19 @@ module StandupMD
|
|
|
137
189
|
|
|
138
190
|
private
|
|
139
191
|
|
|
192
|
+
##
|
|
193
|
+
# Detects zsh completion setup requests before loading user preferences.
|
|
194
|
+
#
|
|
195
|
+
# @return [Boolean]
|
|
196
|
+
def load_zsh_completion_request(options)
|
|
197
|
+
return false unless options.include?("--zsh-completion")
|
|
198
|
+
|
|
199
|
+
invalid_options = options - ["--zsh-completion"]
|
|
200
|
+
raise OptionParser::InvalidArgument, invalid_options.join(" ") unless invalid_options.empty?
|
|
201
|
+
|
|
202
|
+
@zsh_completion_requested = true
|
|
203
|
+
end
|
|
204
|
+
|
|
140
205
|
##
|
|
141
206
|
# Is this a read-only action?
|
|
142
207
|
#
|
data/lib/standup_md/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: standup_md
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evan Gray
|
|
@@ -107,6 +107,7 @@ files:
|
|
|
107
107
|
- Rakefile
|
|
108
108
|
- _config.yml
|
|
109
109
|
- bin/standup
|
|
110
|
+
- completion/zsh/_standup
|
|
110
111
|
- lib/standup_md.rb
|
|
111
112
|
- lib/standup_md/cli.rb
|
|
112
113
|
- lib/standup_md/cli/helpers.rb
|