GithubHelp home page GithubHelp logo

Comments (11)

yannlandry avatar yannlandry commented on August 22, 2024

As of now, I'm on it. I'll need to figure out more than a few things but once we're there we should be able to register commands in the form of a tree.

from taskcluster-cli.

yannlandry avatar yannlandry commented on August 22, 2024

Okay, I've spent a good deal of time thinking and reading up on other issues and it seems the best solution would be to design a custom parser for our needs.

Here is the idea I came up with. Assume the following command/subcommand structure:

   taskcluster
   |         |
help     +---slugid------+
        /    |    |       \
      v4  encode  decode  nice

The new parser would make it easy to create a CommandProvider for each command and each of its subcommands.

To register taskcluster slugid, I would do extpoints.Get("taskcluster").Get("slugid").Register(slugid{}). To register subcommand encode under slugid, I would do extpoints.Get("taskcluster").Get("slugid").Get("encode").Register(encode{}).

It would be possible to register a CommandProvider at each node/leaf of the tree (including the root taskcluster itself), and also to add code to be executed everytime a command under slugid is called.

Obviously, there would also be options to add flags and options to each command and sub*command.

This would resolve:

  • The present issue
  • Issue #68, and give us metadata about options and subcommands
  • Issue #64 (somewhat), and help tab completion

from taskcluster-cli.

yannlandry avatar yannlandry commented on August 22, 2024

Currently trying out github.com/alecthomas/kingpin as @t0xicCode suggested to see if it would work for us.

from taskcluster-cli.

yannlandry avatar yannlandry commented on August 22, 2024

Going custom. Built a command-definition system yesterday, and soon we'll have a parser/framework to go with that. See it in branch subcommands.

from taskcluster-cli.

yannlandry avatar yannlandry commented on August 22, 2024

Today's update:

Added/fixed/changed a few things, and moved the code to a new package named commander. This way we might be able to export this under a new project at some point.

I'll try to do the parser in the next few days and have something working for our meeting on Friday.

from taskcluster-cli.

t0xicCode avatar t0xicCode commented on August 22, 2024

https://github.com/spf13/cobra?

from taskcluster-cli.

yannlandry avatar yannlandry commented on August 22, 2024

Didn't see this one while looking for possible packages to use... some features look similar, interestingly. I didn't look into it too much, however at this point I've got pretty much everything down, including the parser.

from taskcluster-cli.

t0xicCode avatar t0xicCode commented on August 22, 2024

While I don't want you to lose all the work you did, would it make sense to still try the library? If we can use an external library that we don't have to maintain and support, that'd leave more time for use to work on the specific features of the tool.

And cobra has bash completion "for free" as well 😄

from taskcluster-cli.

djmitche avatar djmitche commented on August 22, 2024

My notes from the meeting on Friday indicate we decided:

  • spend a week working to use Cobra
  • we may be able to move to the new system subcommand-by-subcommand. @yannlandry will work on a transition plan

from taskcluster-cli.

yannlandry avatar yannlandry commented on August 22, 2024

Pull request for step 1 online.

See the transition plan for more details.

from taskcluster-cli.

t0xicCode avatar t0xicCode commented on August 22, 2024

Closed by #99.

from taskcluster-cli.

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.