Code Monkey home page Code Monkey logo

Comments (1)

ko1nksm avatar ko1nksm commented on August 17, 2024

Hi,

I have not tried this, but it should already be supported.

e.g.:
command sub-command1 sub-sub-command1

Supplemented it with options/arguments to make it look like follows:

command [global-options] sub-cmd1 [options-for-sub-cmd1] sub-sub-cmd1 [options-for-sub-sub-cmd1] [arguments] 

To parse it, we need to perform three parses.

First parse (for command):

command [global-options] <sub-cmd> {doesn't care about the rest}

Second parse (for sub-cmd1):

sub-cmd1 [options-for-sub-cmd1] <sub-sub-cmd> {doesn't care about the rest}

Third parse (for sub-sub-cmd1):

sub-sub-cmd1 [options-for-sub-sub-cmd1] [arguments]

In other words, the number of subcommands+1 parser definition is required. Defining this in a single shell script would make it hard to read, but if we were developing something large enough to require this, we will separate each subcommand into its own file. In other words, the parser definition is defined in the main shell script and in the shell script for each subcommand.

See also #16.

from getoptions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.