File tree Expand file tree Collapse file tree
src/net/lewisship/cli_tools
test/net/lewisship/cli_tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323* You may now enter ` -h ` or ` --help ` after a group to get help for just that group
2424* Tool help output has been reordered, with top-level tool commands first (previously, those were in a "Builtin" group and listed last)
2525* Tool help now displays just top-level commands by default (add --full to list nested commands)
26+ * When extracting the first sentence as the single-line index, embedded period are no longer considered the end of the sentence
2627* net.lewisship.cli-tools
2728 * New ` command-path ` function returns a composed string of the tool name and command path
2829 * ` dispatch ` function has new options:
Original file line number Diff line number Diff line change 128128 (when repeatable
129129 (if optional " *" " +" )))))
130130
131- (defn- first-sentence
131+ (defn first-sentence
132132 [s]
133133 (when (string? s)
134- (-> s
135- string/trim
136- string/split-lines
137- first
138- (string/split #"\s *\. " )
139- first
140- string/trim)))
134+ (let [s' (-> s
135+ string/trim
136+ string/split-lines
137+ first
138+ (string/split #"\s *\. (?:\s +|$)" )
139+ first)]
140+ (when-not (string/blank? s')
141+ s'))))
141142
142143(defn- indentation-of-line
143144 [line]
Original file line number Diff line number Diff line change 190190 '([:cyan " alpha" ] " , "
191191 [:cyan " bravo" ] " , "
192192 [:cyan " charlie" ] " (or one other)" ))))
193+
194+ (deftest first-sentence
195+ (are [s expected] (= expected (impl/first-sentence s))
196+
197+ " Quick, Simple " " Quick, Simple"
198+
199+ " \n\n The first.\n The second." " The first"
200+
201+ " In namespace x.y.z, we do this thing." " In namespace x.y.z, we do this thing"
202+
203+ nil nil
204+
205+ " " nil
206+ ))
You can’t perform that action at this time.
0 commit comments