toitlang / toitlang/pkg-cli

No good way to create a 'Parsed' object

Open
#16 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Toit
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

It's currently common to call a method with the Parsed object:

  --run=:: foo it


foo parsed/cli.Parsed:
  ...

If I wanted to call the foo function directly, then I would need to create a Parsed object myself. That's currently not really possible.

We should either make this possible, or discourage passing the Parsed object around.

For example, we could encourage to always extract the options in the lambda:

  --run=:: foo it["option1"] it["option2"] ...

That could get messy, and would go against future API plans, where we would like to give a Cli object that has ui, config, and cache (in addition to parsed). That said, maybe parsed shouldn't be part of that object.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the --run=:: entry point and inspect how the Parsed object is passed to foo. Compare direct construction with the proposed option-extraction and future Cli designs. Done means the project has a decided, documented API for invoking foo directly, with the relevant behavior covered.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.