Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
7bbb4843
Commit
7bbb4843
authored
2 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Fix #155: Wrap help strings neatly
parent
317a33f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/code/commandline.lisp
+48
-10
48 additions, 10 deletions
src/code/commandline.lisp
src/general-info/release-21e.md
+1
-0
1 addition, 0 deletions
src/general-info/release-21e.md
with
49 additions
and
10 deletions
src/code/commandline.lisp
+
48
−
10
View file @
7bbb4843
...
...
@@ -339,16 +339,54 @@
(
defun
help-switch-demon
(
switch
)
(
declare
(
ignore
switch
))
(
format
t
(
intl:gettext
"~&Usage: ~A <options>~2%"
)
*command-line-utility-name*
)
(
dolist
(
s
(
sort
*legal-cmd-line-switches*
#'
string<
:key
#'
car
))
(
destructuring-bind
(
name
doc
arg
)
s
(
format
t
" -~A ~@[~A~]~%"
name
(
if
arg
(
intl:gettext
arg
)))
;; Poor man's formatting of the help string
(
with-input-from-string
(
stream
(
intl:gettext
doc
))
(
loop
for
line
=
(
read-line
stream
nil
nil
)
while
line
do
(
format
t
"~8T~A~%"
line
)))))
(
flet
((
get-words
(
s
)
(
declare
(
string
s
))
;; Return a list of all the words from S. A word is defined
;; as any sequence of characters separated from others by
;; whitespace consisting of space, newline, tab, formfeed, or
;; carriage return.
(
let
((
end
(
length
s
)))
(
loop
for
left
=
0
then
(
+
right
1
)
for
right
=
(
or
(
position-if
#'
(
lambda
(
c
)
(
member
c
'
(
#\space
#\newline
#\tab
#\ff
#\cr
)))
s
:start
left
)
end
)
;; Collect the word bounded by left and right in a list.
unless
(
and
(
=
right
left
))
collect
(
subseq
s
left
right
)
into
subseqs
;; Keep going until we reach the end of the string.
until
(
>=
right
end
)
finally
(
return
subseqs
)))))
(
dolist
(
s
(
sort
*legal-cmd-line-switches*
#'
string<
:key
#'
car
))
(
destructuring-bind
(
name
doc
arg
)
s
(
format
t
" -~A ~@[~A~]~%"
name
(
if
arg
(
intl:gettext
arg
)))
;; Poor man's formatting of the help string
(
let
((
*print-right-margin*
80
))
;; Extract all the words from the string and print them out
;; one by one with a space between each, wrapping the output
;; if needed. Each line is indented by 8 spaces.
;;
;; "~@< ~@;"
;; per-line prefix of spaces and pass the whole arg list
;; to this directive.
;;
;; "~{~A~^ ~}"
;; loop over each word and print out the word followed by
;; a space.
;;
;; "~:@>"
;; No suffix, and insert conditional newline after each
;; group of blanks if needed.
(
format
t
"~@< ~@;~{~A~^ ~}~:@>"
(
get-words
(
intl:gettext
doc
))))
(
terpri
))))
(
ext:quit
))
(
defswitch
"help"
#'
help-switch-demon
...
...
This diff is collapsed.
Click to expand it.
src/general-info/release-21e.md
+
1
−
0
View file @
7bbb4843
...
...
@@ -63,6 +63,7 @@ public domain.
*
~~#142~~
`(random 0)`
signals incorrect error
*
~~#147~~
`stream-line-column`
method missing for
`fundamental-character-output-stream`
*
~~#149~~ Call setlocale(3C) on startup
*
~~#155~~ Wrap help strings neatly
*
Other changes:
*
Improvements to the PCL implementation of CLOS:
*
Changes to building procedure:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment