Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completions: for -e, suggest only slugs that are in the config.json file #642

Open
ee7 opened this issue Aug 4, 2022 · 2 comments
Open

Comments

@ee7
Copy link
Member

ee7 commented Aug 4, 2022

Perhaps:

  • if jq is installed, complete the slugs by parsing the track config.json file.
  • otherwise, fall back to looking at directories in exercises/{concept,practice}. But note that configlet fmt|generate|sync -e foo won't work if foo isn't in the track config.json file.
@ee7 ee7 mentioned this issue Aug 8, 2022
@ee7
Copy link
Member Author

ee7 commented Aug 8, 2022

I've thought of the smarter way to fix this, which avoids the dependency on jq.

Is there a program that can parse JSON, that we know is installed on every user's machine at configlet completion time? Yes. Configlet itself.

We could add a subcommand that we omit from the configlet --help message:

configlet __complete

such that tab completion of an exercise slug:

configlet sync --track-dir foo --exercise [Tab]

internally calls:

configlet __complete sync --track-dir foo --exercise

which parses the config.json file in foo and returns the appropriate slugs (for both Concept and Practice Exercises for fmt, and just Practice Exercises for sync).

Low priority for now.

@ErikSchierboom
Copy link
Member

That is a much better option. Neat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants