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

Support per command cheat sheets #4

Closed
2 tasks done
ripienaar opened this issue Jun 6, 2022 · 0 comments
Closed
2 tasks done

Support per command cheat sheets #4

ripienaar opened this issue Jun 6, 2022 · 0 comments

Comments

@ripienaar
Copy link
Member

ripienaar commented Jun 6, 2022

Applications should support opt-in cheat support:

app := New("x", "").WithCheats()
app.Cheat(`# cheat output here`)

cmd := app.Command("sub", "")
cmd.Cheat("# cheat output here")

This should add a x cheat command that works a bit like help but renders the cheat sheets, it should do a few things to behave cheat like such as x cheat sub/other should work to find the cheat for 2 level deep commands etc.

It should support saving them to a directory for use by the normal cheat command x cheat --save <directory> and if some cheat is asked that doesnt exist should list all the sections of cheats in x/y format

The command it creates should be accessible same as HelpCommand etc so users can modify it

ripienaar added a commit that referenced this issue Jun 7, 2022
Adds Cheat() to associate cheat hints with any command
or app. When enabled the cheat command gives access to
these hints in the cheat format

At present saving to cheat not yet supported

Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit that referenced this issue Jun 7, 2022
(#4) initial support for cheats
ripienaar added a commit that referenced this issue Jun 8, 2022
This reworks the cheats somewhat after it became
impossible to save them to a directory structure
based on initial design

Cheats are now a flat map[string]string which works
a bit better and keeps things from being too complex

Saving is supported

Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit that referenced this issue Jun 8, 2022
(#4) complete support for cheats
ripienaar added a commit that referenced this issue Jun 8, 2022
Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit that referenced this issue Jun 8, 2022
Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit that referenced this issue Jun 8, 2022
ripienaar added a commit that referenced this issue Jun 8, 2022
Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit that referenced this issue Jun 8, 2022
(#4) ensures --help works on the cheats command
ripienaar added a commit that referenced this issue Jun 8, 2022
Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit that referenced this issue Jun 8, 2022
(#4) allow reading cheats from an embeded fs
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

1 participant