Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, arguments::generate_parser function. Install bash-modules, then run `. import.sh log arguments`, then call `arguments::generate_parser '--foo)FOO;String'` , and it will generate function with parser, which include parser for foo option for both `--foo VALUE` and `--foo=VALUE`:

  ...
  
        --foo)
          FOO="${2:?ERROR: String value is required for \"-f|--foo\" option. See --help for details.}"
          shift 2
        ;;
        --foo=*)
          FOO="${1#*=}"
          shift 1
        ;;
  ...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: