github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/man-get-flags.md (about)

     1  # `man-get-flags` 
     2  
     3  > Parses man page files for command line flags 
     4  
     5  ## Description
     6  
     7  Sometimes you might want to programmatically search `man` pages for any
     8  supported flag. Particularly if you're writing a dynamic autocompletion.
     9  `man-get-flags` does this and returns a JSON document.
    10  
    11  You can either pipe a man page to `man-get-flags`, or pass the name of the
    12  command as a parameter.
    13  
    14  `man-get-flags` returns a JSON document. Either an array or an object,
    15  depending on what flags (if any) are passed.
    16  
    17  If no flags are passed, `man-get-flags` will default to just parsing the man
    18  page for anything that looks like a flag (ie no descriptions or other detail).
    19  
    20  ## Usage
    21  
    22  ```
    23  <stdin> -> man-get-flags [--descriptions] -> <stdout>
    24  
    25  man-get-flags command [--descriptions] -> <stdout>
    26  ```
    27  
    28  ## Examples
    29  
    30  ```
    31  » man-get-flags --descriptions find -> [{$.key =~ 'regex'}]
    32  {
    33      "-iregex": "eg: pattern -- Like -regex, but the match is case insensitive.",
    34      "-regex": "eg: pattern -- True if the whole path of the file matches pattern using regular expression.  To match a file named “./foo/xyzzy”, you can use the regular expression “.*/[xyz]*” or “.*/foo/.*”, but not “xyzzy” or “/foo/”."
    35  }
    36  ```
    37  
    38  ## Flags
    39  
    40  * `--descriptions`
    41      return a map of flags with their described usage
    42  * `-d`
    43      shorthand for `--descriptions`
    44  
    45  ## Detail
    46  
    47  ### Limitations
    48  
    49  Due to the freeform nature of man pages - that they're intended to be human
    50  readable rather than machine readable - and the flexibility that developers
    51  have to parse command line parameters however they wish, there will always be
    52  a margin for error with how reliably any parser can autodetect parameters. one
    53  requirement is that flags are hyphen prefixed, eg `--flag`.
    54  
    55  ## See Also
    56  
    57  * [`man-summary`](../commands/man-summary.md):
    58    Outputs a man page summary of a command
    59  * [`murex-docs`](../commands/murex-docs.md):
    60    Displays the man pages for Murex builtins
    61  * [`summary` ](../commands/summary.md):
    62    Defines a summary help text for a command
    63  
    64  <hr/>
    65  
    66  This document was generated from [builtins/core/management/shell_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/management/shell_doc.yaml).