Changeset 17942 in project


Ignore:
Timestamp:
04/27/10 07:17:54 (9 years ago)
Author:
Jim Ursetto
Message:

wiki/args: Update for chicken-doc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/args

    r17556 r17942  
    11[[tags:eggs]]
    22
    3 The '''args''' extension library for Chicken Scheme.
     3''args'' provides command-line argument handling, implemented
     4on top of [[http://srfi.schemers.org/srfi-37/srfi-37.html|SRFI 37's args-fold]].
    45
    56[[toc:]]
    6 
    7 == Description
    8 
    9 Command-line argument handling, on top of SRFI 37
    10 
    117
    128== Documentation
     
    2521options and usage information don't get out of sync.
    2622
    27 
    2823=== Creating options
    2924
    30 ==== args:make-option
    31 
    32  <macro>(args:make-option (OPTION-NAME ...) ARG-DATA DOCSTRING [BODY])</macro>
     25<macro>(args:make-option (OPTION-NAME ...) ARG-DATA DOCSTRING [BODY])</macro>
    3326
    3427Make an {{args:option}} record, suitable for passing to {{args:parse}}.
     
    6760=== Parsing the command line
    6861
    69 ==== args:parse
    70 
    71  <procedure>(args:parse ARGS OPTIONS-LIST [OPTIONALS])</procedure>
     62<procedure>(args:parse ARGS OPTIONS-LIST [OPTIONALS])</procedure>
    7263
    7364Parse {{ARGS}}, a list of command-line arguments given as strings, and return
     
    9687arguments; {{OPTIONS}} and {{OPERANDS}} are seed values.
    9788
    98 ==== args:help-options
    99 
    100  <parameter>(args:help-options [default: ("help" #\h #\?)])</parameter>
     89<parameter>(args:help-options [default: ("help" #\h #\?)])</parameter>
    10190
    10291List of option names (strings or single characters, as in SRFI 37) to be
     
    10695invoked.
    10796
    108 
    10997=== Usage information
    11098
     
    114102descriptive header and footer.
    115103
    116 ==== args:usage
    117 
    118  <procedure>(args:usage OPTION-LIST)</procedure>
     104<procedure>(args:usage OPTION-LIST)</procedure>
    119105
    120106Generate a formatted list of options from {{OPTION-LIST}}, and return a string
     
    123109{{(print (args:usage opts)).}}
    124110
    125 ==== args:width
    126 
    127  <parameter>(args:width [default: 25])</parameter>
     111<parameter>(args:width [default: 25])</parameter>
    128112
    129113Width of the left (option) column. We don't automatically format this column
    130114based on the length of the longest option, but you can set its width manually.
    131115
    132 ==== args:separator
    133 
    134  <parameter>(args:separator [default: ", "])</parameter>
     116<parameter>(args:separator [default: ", "])</parameter>
    135117
    136118The string separator inserted between multiple options on the same line.
    137119
    138 ==== args:indent
    139 
    140  <parameter>(args:indent [default: 1])</parameter>
     120<parameter>(args:indent [default: 1])</parameter>
    141121
    142122Number of spaces to indent the options from the left.
    143 
    144123
    145124=== Operands and unrecognized options (advanced)
     
    149128themselves, but a couple useful prefabricated ones are provided.
    150129
    151 ==== args:ignore-unrecognized-options
    152 
    153  <procedure>(args:ignore-unrecognized-options)</procedure>
     130<procedure>(args:ignore-unrecognized-options)</procedure>
    154131
    155132Silently ignore unrecognized options, and omit from the options alist.
    156133
    157 ==== args:accept-unrecognized-options
    158 
    159  <procedure>(args:accept-unrecognized-options)</procedure>
     134<procedure>(args:accept-unrecognized-options)</procedure>
    160135
    161136Silently add unrecognized options to the options alist.
     
    193168
    194169If command line is {{--cookie -e test -e hello}}:
     170
    195171   cookie was tasty
    196172   elephant: arg is test
     
    216192
    217193Using indent 5, width 35 and a single space for the separator:
     194
    218195 #;> (print (parameterize ((args:separator " ")
    219196                           (args:indent 5)
     
    234211== Bugs
    235212
    236 
    237213The name {{args:make-option}} is verbose.
    238214
    239 
    240215== About this egg
    241 
    242216
    243217=== Author
     
    256230=== Requirements
    257231
    258 {{srfi-37 [args-fold]}}, {{srfi-13 [string-lib]}}, {{srfi-1 [list-lib]}}
    259 
     232[[srfi-37]]
    260233
    261234=== License
    262235
    263  Copyright (c) 2005, 2006, 2007 Jim Ursetto.  All rights reserved.
     236 Copyright (c) 2005-2010 Jim Ursetto.  All rights reserved.
    264237 
    265238 Redistribution and use in source and binary forms, with or without
Note: See TracChangeset for help on using the changeset viewer.