Changeset 40541 in project


Ignore:
Timestamp:
09/13/21 23:28:26 (12 days ago)
Author:
Jim Ursetto
Message:

5/args: Wrap long options in args:usage (@tkurtbond)

Location:
release/5/args/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/args/trunk/args-examples.scm

    r36402 r40541  
    2020          (print "elephant: arg is " arg))
    2121        (args:make-option (f file)      (required: "NAME") "parse file NAME")
     22        (args:make-option (l really-long-option-name) (required: "NAME") "very long option NAME to show wrapping")
    2223        (args:make-option (v V version) #:none     "Display version"
    2324          (print "args-examples $Revision: 1.16 $")
  • release/5/args/trunk/args.scm

    r36399 r40541  
    214214  (let ((option-string (commify o)))
    215215    (string-append (spaces (args:indent))
    216                    (string-pad-right option-string (args:width))
    217                    (args:option-docstring o) "\n")))
     216                  (if (>= (+ (args:indent) (string-length option-string))
     217                          (args:width))
     218                      (string-append option-string "\n"
     219                                     (string-pad-right "" (+ (args:width)
     220                                                             (args:indent)))
     221                                     (args:option-docstring o) "\n")
     222                      (string-append
     223                       (string-pad-right option-string (args:width))
     224                       (args:option-docstring o) "\n")))))
    218225
    219226;;; procedure: (args:usage OPTION-LIST)
Note: See TracChangeset for help on using the changeset viewer.