Shell-style argument parsing

Author(s): Jose F. Morales.

This module implements shell-style argument parsing. This is useful for parsing argument strings from other tools (e.g., those returned by pkg-config) and using them in calls to process_call/3 (without using a full shell interpreter).

It offers a parse_shell_args/2 predicate that splits a single input into a list of arguments, following these rules:

  • arguments are separated by blanks (whitespaces or tabulators)
  • arguments may contain double and single quoted substrings (quotes are removed)
  • blanks are not separators when they appear in quoted strings
  • escape character removes special meaning from blank or quote characters

Note that this library is not intended to do full shell parsing (command or variable substitutions, etc.).

Usage and interface

  • Library usage:
    :- use_module(library(parse_shell_args)).
  • Exports:

Documentation on exports

Usage:parse_shell_args(Atm,Args)

Parse shell-style arguments from atom Atm into Args

Documentation on imports

This module has the following direct dependencies: