na 1.2.73 → 1.2.75
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/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +623 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +29 -4
- data/Gemfile +25 -1
- data/Gemfile.lock +132 -15
- data/README.md +2 -2
- data/Rakefile +147 -32
- data/bin/commands/add.rb +1 -1
- data/bin/commands/find.rb +67 -67
- data/bin/commands/next.rb +85 -85
- data/bin/commands/tagged.rb +60 -60
- data/docker/Dockerfile +10 -0
- data/docker/Dockerfile-2.6 +11 -0
- data/docker/Dockerfile-2.7 +11 -0
- data/docker/Dockerfile-3.0 +11 -0
- data/docker/Dockerfile-3.3 +12 -0
- data/docker/bash_profile +17 -0
- data/docker/inputrc +57 -0
- data/docker/sources.list +11 -0
- data/lib/na/actions.rb +48 -46
- data/lib/na/next_action.rb +1 -1
- data/lib/na/version.rb +1 -1
- data/na.gemspec +5 -7
- data/scripts/generate-fish-completions.rb +170 -0
- data/scripts/runtests.sh +5 -0
- data/src/_README.md +1 -1
- metadata +43 -59
data/bin/commands/tagged.rb
CHANGED
@@ -2,121 +2,121 @@
|
|
2
2
|
|
3
3
|
class App
|
4
4
|
extend GLI::App
|
5
|
-
desc
|
5
|
+
desc "Find actions matching a tag"
|
6
6
|
long_desc 'Finds actions with tags matching the arguments. An action is shown if it
|
7
7
|
contains all of the tags listed. Add a + before a tag to make it required
|
8
8
|
and others optional. You can specify values using TAG=VALUE pairs.
|
9
9
|
Use <, >, and = for numeric comparisons, and *=, ^=, $=, or =~ (regex) for text comparisons.
|
10
10
|
Date comparisons use natural language (`na tagged "due<=today"`) and
|
11
11
|
are detected automatically.'
|
12
|
-
arg_name
|
12
|
+
arg_name "TAG[=VALUE]"
|
13
13
|
command %i[tagged] do |c|
|
14
|
-
c.example
|
15
|
-
c.example 'na tagged -d 3 "feature, idea"', desc:
|
16
|
-
c.example 'na tagged --or "feature, idea"', desc:
|
17
|
-
c.example 'na tagged "priority>=4"', desc:
|
18
|
-
c.example 'na tagged "due<in 2 days"', desc:
|
19
|
-
|
20
|
-
c.desc
|
21
|
-
c.arg_name
|
14
|
+
c.example "na tagged maybe", desc: "Show all actions tagged @maybe"
|
15
|
+
c.example 'na tagged -d 3 "feature, idea"', desc: "Show all actions tagged @feature AND @idea, recurse 3 levels"
|
16
|
+
c.example 'na tagged --or "feature, idea"', desc: "Show all actions tagged @feature OR @idea"
|
17
|
+
c.example 'na tagged "priority>=4"', desc: "Show actions with @priority(4) or @priority(5)"
|
18
|
+
c.example 'na tagged "due<in 2 days"', desc: "Show actions with a due date coming up in the next 2 days"
|
19
|
+
|
20
|
+
c.desc "Recurse to depth"
|
21
|
+
c.arg_name "DEPTH"
|
22
22
|
c.default_value 1
|
23
23
|
c.flag %i[d depth], type: :integer, must_match: /^\d+$/
|
24
24
|
|
25
|
-
c.desc
|
26
|
-
c.arg_name
|
25
|
+
c.desc "Show actions from a specific todo file in history. May use wildcards (* and ?)"
|
26
|
+
c.arg_name "TODO_PATH"
|
27
27
|
c.flag %i[in]
|
28
28
|
|
29
|
-
c.desc
|
29
|
+
c.desc "Include notes in output"
|
30
30
|
c.switch %i[notes], negatable: true, default_value: false
|
31
31
|
|
32
|
-
c.desc
|
32
|
+
c.desc "Combine tags with OR, displaying actions matching ANY of the tags"
|
33
33
|
c.switch %i[o or], negatable: false
|
34
34
|
|
35
|
-
c.desc
|
36
|
-
c.arg_name
|
35
|
+
c.desc "Show actions from a specific project"
|
36
|
+
c.arg_name "PROJECT[/SUBPROJECT]"
|
37
37
|
c.flag %i[proj project]
|
38
38
|
|
39
|
-
c.desc
|
40
|
-
c.arg_name
|
39
|
+
c.desc "Filter results using search terms"
|
40
|
+
c.arg_name "QUERY"
|
41
41
|
c.flag %i[search find grep], multiple: true
|
42
42
|
|
43
|
-
c.desc
|
43
|
+
c.desc "Include notes in search"
|
44
44
|
c.switch %i[search_notes], negatable: true, default_value: true
|
45
45
|
|
46
|
-
c.desc
|
46
|
+
c.desc "Search query is regular expression"
|
47
47
|
c.switch %i[regex], negatable: false
|
48
48
|
|
49
|
-
c.desc
|
49
|
+
c.desc "Search query is exact text match (not tokens)"
|
50
50
|
c.switch %i[exact], negatable: false
|
51
51
|
|
52
|
-
c.desc
|
52
|
+
c.desc "Include @done actions"
|
53
53
|
c.switch %i[done]
|
54
54
|
|
55
|
-
c.desc
|
55
|
+
c.desc "Show actions not matching tags"
|
56
56
|
c.switch %i[v invert], negatable: false
|
57
57
|
|
58
|
-
c.desc
|
59
|
-
c.arg_name
|
58
|
+
c.desc "Save this search for future use"
|
59
|
+
c.arg_name "TITLE"
|
60
60
|
c.flag %i[save]
|
61
61
|
|
62
|
-
c.desc
|
62
|
+
c.desc "Output actions nested by file"
|
63
63
|
c.switch %i[nest], negatable: false
|
64
64
|
|
65
|
-
c.desc
|
65
|
+
c.desc "Output actions nested by file and project"
|
66
66
|
c.switch %i[omnifocus], negatable: false
|
67
67
|
|
68
68
|
c.action do |global_options, options, args|
|
69
69
|
options[:nest] = true if options[:omnifocus]
|
70
70
|
|
71
71
|
if options[:save]
|
72
|
-
title = options[:save].gsub(/[^a-z0-9]/,
|
73
|
-
cmd = NA.command_line.join(
|
72
|
+
title = options[:save].gsub(/[^a-z0-9]/, "_").gsub(/_+/, "_")
|
73
|
+
cmd = NA.command_line.join(" ").sub(/ --save[= ]*\S+/, "").split(" ").map { |t| %("#{t}") }.join(" ")
|
74
74
|
NA.save_search(title, cmd)
|
75
75
|
end
|
76
76
|
|
77
77
|
depth = if global_options[:recurse] && options[:depth].nil? && global_options[:depth] == 1
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
3
|
79
|
+
else
|
80
|
+
options[:depth].nil? ? global_options[:depth].to_i : options[:depth].to_i
|
81
|
+
end
|
82
82
|
|
83
83
|
tags = []
|
84
84
|
|
85
|
-
all_req = args.join(
|
86
|
-
args.join(
|
85
|
+
all_req = args.join(" ") !~ /(?<=[, ])[+!-]/ && !options[:or]
|
86
|
+
args.join(",").split(/ *, */).each do |arg|
|
87
87
|
m = arg.match(/^(?<req>[+!-])?(?<tag>[^ =<>$~\^]+?) *(?:(?<op>[=<>~]{1,2}|[*$\^]=) *(?<val>.*?))?$/)
|
88
88
|
next if m.nil?
|
89
89
|
|
90
90
|
tags.push({
|
91
|
-
tag: m[
|
92
|
-
comp: m[
|
93
|
-
value: m[
|
94
|
-
required: all_req || (!m[
|
95
|
-
negate: !m[
|
91
|
+
tag: m["tag"].sub(/^@/, "").wildcard_to_rx,
|
92
|
+
comp: m["op"],
|
93
|
+
value: m["val"],
|
94
|
+
required: all_req || (!m["req"].nil? && m["req"] == "+"),
|
95
|
+
negate: !m["req"].nil? && m["req"] =~ /[!-]/,
|
96
96
|
})
|
97
97
|
end
|
98
98
|
|
99
99
|
search_for_done = false
|
100
100
|
tags.each { |tag| search_for_done = true if tag[:tag] =~ /done/ }
|
101
|
-
tags.push({ tag:
|
101
|
+
tags.push({ tag: "done", value: nil, negate: true }) unless search_for_done || options[:done]
|
102
102
|
options[:done] = true if search_for_done
|
103
103
|
|
104
104
|
tokens = nil
|
105
105
|
if options[:search]
|
106
106
|
if options[:exact]
|
107
|
-
tokens = options[:search].join(
|
107
|
+
tokens = options[:search].join(" ")
|
108
108
|
elsif options[:regex]
|
109
|
-
tokens = Regexp.new(options[:search].join(
|
109
|
+
tokens = Regexp.new(options[:search].join(" "), Regexp::IGNORECASE)
|
110
110
|
else
|
111
111
|
tokens = []
|
112
|
-
all_req = options[:search].join(
|
112
|
+
all_req = options[:search].join(" ") !~ /(?<=[, ])[+!-]/ && !options[:or]
|
113
113
|
|
114
|
-
options[:search].join(
|
114
|
+
options[:search].join(" ").split(/ /).each do |arg|
|
115
115
|
m = arg.match(/^(?<req>[+\-!])?(?<tok>.*?)$/)
|
116
116
|
tokens.push({
|
117
|
-
token: m[
|
118
|
-
required: all_req || (!m[
|
119
|
-
negate: !m[
|
117
|
+
token: m["tok"],
|
118
|
+
required: all_req || (!m["req"].nil? && m["req"] == "+"),
|
119
|
+
negate: !m["req"].nil? && m["req"] =~ /[!-]/,
|
120
120
|
})
|
121
121
|
end
|
122
122
|
end
|
@@ -129,9 +129,9 @@ class App
|
|
129
129
|
options[:in].split(/ *, */).each do |a|
|
130
130
|
m = a.match(/^(?<req>[+\-!])?(?<tok>.*?)$/)
|
131
131
|
todos.push({
|
132
|
-
token: m[
|
133
|
-
required: all_req || (!m[
|
134
|
-
negate: !m[
|
132
|
+
token: m["tok"],
|
133
|
+
required: all_req || (!m["req"].nil? && m["req"] == "+"),
|
134
|
+
negate: !m["req"].nil? && m["req"] =~ /[!-]/,
|
135
135
|
})
|
136
136
|
end
|
137
137
|
end
|
@@ -149,16 +149,16 @@ class App
|
|
149
149
|
require_na: false })
|
150
150
|
|
151
151
|
regexes = if tokens.is_a?(Array)
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
152
|
+
tokens.delete_if { |token| token[:negate] }.map { |token| token[:token] }
|
153
|
+
else
|
154
|
+
[tokens]
|
155
|
+
end
|
156
156
|
todo.actions.output(depth,
|
157
|
-
files: todo.files,
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
157
|
+
{ files: todo.files,
|
158
|
+
regexes: regexes,
|
159
|
+
notes: options[:notes],
|
160
|
+
nest: options[:nest],
|
161
|
+
nest_projects: options[:omnifocus] })
|
162
162
|
end
|
163
163
|
end
|
164
164
|
end
|
data/docker/Dockerfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
FROM ruby:3.1.3-slim
|
2
|
+
RUN mkdir /na
|
3
|
+
WORKDIR /na
|
4
|
+
RUN gem install bundler:2.2
|
5
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
6
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
7
|
+
RUN apt-get install -y less vim
|
8
|
+
COPY ./docker/inputrc /root/.inputrc
|
9
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
10
|
+
CMD ["/na/scripts/runtests.sh"]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
FROM ruby:2.6
|
2
|
+
RUN mkdir /na
|
3
|
+
WORKDIR /na
|
4
|
+
RUN gem install bundler:2.2
|
5
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
6
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
7
|
+
RUN apt-get install -y sudo || true
|
8
|
+
RUN sudo apt-get install -y less vim || true
|
9
|
+
COPY ./docker/inputrc /root/.inputrc
|
10
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
11
|
+
CMD ["/na/scripts/runtests.sh"]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
FROM ruby:2.7
|
2
|
+
RUN mkdir /na
|
3
|
+
WORKDIR /na
|
4
|
+
RUN gem install bundler:2.2
|
5
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
6
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
7
|
+
RUN apt-get install -y sudo || true
|
8
|
+
RUN sudo apt-get install -y less vim || true
|
9
|
+
COPY ./docker/inputrc /root/.inputrc
|
10
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
11
|
+
CMD ["/na/scripts/runtests.sh"]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
FROM ruby:3.0.0
|
2
|
+
RUN mkdir /na
|
3
|
+
WORKDIR /na
|
4
|
+
RUN gem install bundler:2.2
|
5
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
6
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
7
|
+
RUN apt-get install -y sudo || true
|
8
|
+
RUN sudo apt-get install -y less vim || true
|
9
|
+
COPY ./docker/inputrc /root/.inputrc
|
10
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
11
|
+
CMD ["/na/scripts/runtests.sh"]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FROM ruby:3.3.0
|
2
|
+
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
3
|
+
RUN mkdir /na
|
4
|
+
WORKDIR /na
|
5
|
+
RUN gem install bundler:2.2
|
6
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
7
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
8
|
+
RUN apt-get install -y sudo || true
|
9
|
+
RUN sudo apt-get install -y less vim || true
|
10
|
+
COPY ./docker/inputrc /root/.inputrc
|
11
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
12
|
+
CMD ["/na/scripts/runtests.sh"]
|
data/docker/bash_profile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
export GLI_DEBUG=true
|
3
|
+
export EDITOR="/usr/bin/vim"
|
4
|
+
alias b="bundle exec bin/na"
|
5
|
+
alias be="bundle exec"
|
6
|
+
alias quit="exit"
|
7
|
+
|
8
|
+
shopt -s nocaseglob
|
9
|
+
shopt -s histappend
|
10
|
+
shopt -s histreedit
|
11
|
+
shopt -s histverify
|
12
|
+
shopt -s cmdhist
|
13
|
+
|
14
|
+
cd /na
|
15
|
+
bundle update
|
16
|
+
gem update --system
|
17
|
+
gem install pkg/*.gem
|
data/docker/inputrc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
"\e[3~": delete-char
|
2
|
+
"\ex": 'cd !$ \015ls\015'
|
3
|
+
"\ez": 'cd -\015'
|
4
|
+
"\e\C-m": '\C-a "$(\C-e|fzf)"\C-a'
|
5
|
+
"\e/": '"$(!!|fzf)"\C-a \C-m\C-m'
|
6
|
+
# these allow you to use alt+left/right arrow keys
|
7
|
+
# to jump the cursor over words
|
8
|
+
"\e[1;5C": forward-word
|
9
|
+
"\e[1;5D": backward-word
|
10
|
+
# "\e[D": backward-word
|
11
|
+
# "\e[C": forward-word
|
12
|
+
"\ea": menu-complete
|
13
|
+
# TAB: menu-complete
|
14
|
+
# "\e[Z": "\e-1\C-i"
|
15
|
+
|
16
|
+
"\e\C-l": history-and-alias-expand-line
|
17
|
+
|
18
|
+
# these allow you to start typing a command and
|
19
|
+
# use the up/down arrow to auto complete from
|
20
|
+
# commands in your history
|
21
|
+
"\e[B": history-search-forward
|
22
|
+
"\e[A": history-search-backward
|
23
|
+
"\ew": history-search-backward
|
24
|
+
"\es": history-search-forward
|
25
|
+
# this lets you hit tab to auto-complete a file or
|
26
|
+
# directory name ignoring case
|
27
|
+
set completion-ignore-case On
|
28
|
+
set mark-symlinked-directories On
|
29
|
+
set completion-prefix-display-length 2
|
30
|
+
set bell-style none
|
31
|
+
# set bell-style visible
|
32
|
+
set meta-flag on
|
33
|
+
set convert-meta off
|
34
|
+
set input-meta on
|
35
|
+
set output-meta on
|
36
|
+
set show-all-if-ambiguous on
|
37
|
+
set show-all-if-unmodified on
|
38
|
+
set completion-map-case on
|
39
|
+
set visible-stats on
|
40
|
+
|
41
|
+
# Do history expansion when space entered?
|
42
|
+
$if bash
|
43
|
+
Space: magic-space
|
44
|
+
$endif
|
45
|
+
|
46
|
+
# Show extra file information when completing, like `ls -F` does
|
47
|
+
set visible-stats on
|
48
|
+
|
49
|
+
# Be more intelligent when autocompleting by also looking at the text after
|
50
|
+
# the cursor. For example, when the current line is "cd ~/src/mozil", and
|
51
|
+
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd
|
52
|
+
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the
|
53
|
+
# Readline used by Bash 4.)
|
54
|
+
set skip-completed-text on
|
55
|
+
|
56
|
+
# Use Alt/Meta + Delete to delete the preceding word
|
57
|
+
"\e[3;3~": kill-word
|
data/docker/sources.list
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
|
2
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
|
3
|
+
deb http://archive.ubuntu.com/ubuntu/ focal universe
|
4
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
|
5
|
+
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
|
6
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
|
7
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
|
8
|
+
|
9
|
+
deb http://security.ubuntu.com/ubuntu focal-security main restricted
|
10
|
+
deb http://security.ubuntu.com/ubuntu focal-security universe
|
11
|
+
deb http://security.ubuntu.com/ubuntu focal-security multiversesudo apt update
|
data/lib/na/actions.rb
CHANGED
@@ -11,80 +11,82 @@ module NA
|
|
11
11
|
##
|
12
12
|
## Pretty print a list of actions
|
13
13
|
##
|
14
|
-
## @param
|
15
|
-
## @param
|
16
|
-
## @param files [Array] The files actions originally came from
|
17
|
-
## @param regexes [Array] The regexes used to gather actions
|
14
|
+
## @param depth [Integer] The depth of the action
|
15
|
+
## @param config [Hash] The configuration options
|
18
16
|
##
|
19
|
-
|
20
|
-
|
17
|
+
## @option config [Array] :files The files to include in the output
|
18
|
+
## @option config [Array] :regexes The regexes to match against
|
19
|
+
## @option config [Boolean] :notes Whether to include notes in the output
|
20
|
+
## @option config [Boolean] :nest Whether to nest the output
|
21
|
+
## @option config [Boolean] :nest_projects Whether to nest projects in the output
|
22
|
+
## @option config [Boolean] :no_files Whether to include files in the output
|
23
|
+
##
|
24
|
+
## @return [String] The output string
|
25
|
+
##
|
26
|
+
def output(depth, config = {})
|
27
|
+
defaults = {
|
28
|
+
files: nil,
|
29
|
+
regexes: [],
|
30
|
+
notes: false,
|
31
|
+
nest: false,
|
32
|
+
nest_projects: false,
|
33
|
+
no_files: false,
|
34
|
+
}
|
35
|
+
config = defaults.merge(config)
|
21
36
|
|
22
|
-
if
|
37
|
+
return if config[:files].nil?
|
38
|
+
|
39
|
+
if config[:nest]
|
23
40
|
template = NA.theme[:templates][:default]
|
24
|
-
template = NA.theme[:templates][:no_file] if no_files
|
41
|
+
template = NA.theme[:templates][:no_file] if config[:no_files]
|
25
42
|
|
26
43
|
parent_files = {}
|
27
44
|
out = []
|
28
45
|
|
29
|
-
if nest_projects
|
46
|
+
if config[:nest_projects]
|
30
47
|
each do |action|
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
parent_files[action.file] = [action]
|
35
|
-
end
|
48
|
+
parent_files[action.file] ||= []
|
49
|
+
parent_files[action.file].push(action)
|
36
50
|
end
|
37
51
|
|
38
52
|
parent_files.each do |file, acts|
|
39
53
|
projects = NA.project_hierarchy(acts)
|
40
|
-
out.push("#{file.sub(%r{^./},
|
54
|
+
out.push("#{file.sub(%r{^./}, "").shorten_path}:")
|
41
55
|
out.concat(NA.output_children(projects, 0))
|
42
56
|
end
|
43
57
|
else
|
44
58
|
template = NA.theme[:templates][:default]
|
45
|
-
template = NA.theme[:templates][:no_file] if no_files
|
59
|
+
template = NA.theme[:templates][:no_file] if config[:no_files]
|
46
60
|
|
47
61
|
each do |action|
|
48
|
-
|
49
|
-
|
50
|
-
else
|
51
|
-
parent_files[action.file] = [action]
|
52
|
-
end
|
62
|
+
parent_files[action.file] ||= []
|
63
|
+
parent_files[action.file].push(action)
|
53
64
|
end
|
54
65
|
|
55
|
-
parent_files.each do |
|
56
|
-
out.push("#{
|
57
|
-
|
58
|
-
out.push("\t- [#{a.parent.join(
|
66
|
+
parent_files.each do |file, acts|
|
67
|
+
out.push("#{file.sub(%r{^\./}, "")}:")
|
68
|
+
acts.each do |a|
|
69
|
+
out.push("\t- [#{a.parent.join("/")}] #{a.action}")
|
59
70
|
out.push("\t\t#{a.note.join("\n\t\t")}") unless a.note.empty?
|
60
71
|
end
|
61
72
|
end
|
62
73
|
end
|
63
74
|
NA::Pager.page out.join("\n")
|
64
75
|
else
|
65
|
-
template =
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
if depth > 1
|
76
|
-
NA.theme[:templates][:multi_file]
|
77
|
-
else
|
78
|
-
NA.theme[:templates][:single_file]
|
79
|
-
end
|
80
|
-
else
|
81
|
-
NA.theme[:templates][:default]
|
82
|
-
end
|
83
|
-
template += '%note' if notes
|
76
|
+
template = if config[:no_files]
|
77
|
+
NA.theme[:templates][:no_file]
|
78
|
+
elsif config[:files].count.positive?
|
79
|
+
config[:files].count == 1 ? NA.theme[:templates][:single_file] : NA.theme[:templates][:multi_file]
|
80
|
+
elsif NA.find_files(depth: depth).count > 1
|
81
|
+
depth > 1 ? NA.theme[:templates][:multi_file] : NA.theme[:templates][:single_file]
|
82
|
+
else
|
83
|
+
NA.theme[:templates][:default]
|
84
|
+
end
|
85
|
+
template += "%note" if config[:notes]
|
84
86
|
|
85
|
-
files.map { |f| NA.notify(f, debug: true) } if files
|
87
|
+
config[:files].map { |f| NA.notify(f, debug: true) } if config[:files]
|
86
88
|
|
87
|
-
output = map { |action| action.pretty(template: { templates: { output: template } }, regexes: regexes, notes: notes) }
|
89
|
+
output = map { |action| action.pretty(template: { templates: { output: template } }, regexes: config[:regexes], notes: config[:notes]) }
|
88
90
|
NA::Pager.page(output.join("\n"))
|
89
91
|
end
|
90
92
|
end
|
data/lib/na/next_action.rb
CHANGED
data/lib/na/version.rb
CHANGED
data/na.gemspec
CHANGED
@@ -17,19 +17,17 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.license = 'MIT'
|
18
18
|
s.files =`git ls-files -z`.split("\x0").reject { |f| f.strip =~ %r{^((test|spec|features)/|\.git|buildnotes|.*\.taskpaper)} }
|
19
19
|
s.require_paths << 'lib'
|
20
|
-
s.extra_rdoc_files = ['README.md','na.rdoc']
|
20
|
+
s.extra_rdoc_files = ['README.md', 'na.rdoc']
|
21
21
|
s.rdoc_options << '--title' << 'na' << '--main' << 'README.md' << '--markup' << 'markdown'
|
22
22
|
s.bindir = 'bin'
|
23
23
|
s.executables << 'na'
|
24
|
-
s.add_development_dependency('rake','~> 0.9.2')
|
25
|
-
s.add_development_dependency('rdoc', '~> 4.3')
|
26
24
|
s.add_development_dependency('minitest', '~> 5.14')
|
27
|
-
s.add_development_dependency('
|
28
|
-
s.
|
25
|
+
s.add_development_dependency('rdoc', '~> 4.3')
|
26
|
+
s.add_runtime_dependency('chronic', '~> 0.10', '>= 0.10.2')
|
29
27
|
s.add_runtime_dependency('gli','~> 2.21.0')
|
28
|
+
s.add_runtime_dependency('mdless', '~> 1.0', '>= 1.0.32')
|
30
29
|
s.add_runtime_dependency('tty-reader', '~> 0.9', '>= 0.9.0')
|
31
30
|
s.add_runtime_dependency('tty-screen', '~> 0.8', '>= 0.8.1')
|
32
31
|
s.add_runtime_dependency('tty-which', '~> 0.5', '>= 0.5.0')
|
33
|
-
s.
|
34
|
-
s.add_runtime_dependency('mdless', '~> 1.0', '>= 1.0.32')
|
32
|
+
s.add_development_dependency('tty-spinner', '~> 0.9', '>= 0.9.0')
|
35
33
|
end
|