Giter VIP home page Giter VIP logo

cli's People

Contributors

carnesen avatar dependabot[bot] avatar greenkeeperio-bot avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

cli's Issues

Support for built-in `--version` mechanism

It might be nice if we made a built-in feature where it will automatically do a sensible thing on (maybe) --version if the root is a ICliCommand or version if it's a branch.

Set up server-side website tracking

It'll be more accurate than client-side tracking #88 . I'm super curious to see how big of a difference it makes on page views especially with an engineer audience.

Create example of a CLI as a toggleable overlay

I was thinking about good use cases for a browser CLI and I think the best one is a hidden bespoke admin console for a front-end applications. Imagine a big browser app where if you hit CTRL-OPTION-T it opens up a terminal with a slick per-page custom console from which you can manipulate the state of the application. In our console we could toggle light and dark modes for example.

Built-in generation of bash completions

Now that we have come so far with the autocomplete functionality for CliRepl, it would be awesome if we leverage that command completion for Node.js CLIs executed in bash.

We could offer a CLI command to get these autocompletions into a shell that would look something like (for a CLI my-cli):

completionsCommand = CliCommand({
  name: 'completions',
  action() {
    return `
# This command is meant to be used as "eval $(my-cli completions)"
command -W ...
`

The user would do:

$ eval $(my-cli completions)

https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html
Personally I still use bash, but probably we could/should do this for other shells too.

Automate type testing

We have extensive automated testing of the runtime behavior of this library. As a TypeScript-first library let's also automate testing of our types using the new-in-TypeScript-3.9 // @ts-expect-error Comments or some other type testing framework.

Support single and double quoting in CliRepl

In a shell we can use single and double quotes to "escape" whitespace. For example, echo "foo bar" tells the shell to echo a single string foo bar whereas echo foo bar passes foo and bar as separate arguments to echo. Let's support something like this in the CliRepl so that people can supply input as e.g. parse '{"foo": "bar"}'or even simplyecho "foo"` and have it behave as they'd expect in a shell.

Command links within usage

Here is an example of the scenario we want to support:

$ cloud users list
Error: Server responded 401. Did you run "cloud login" yet?

Currently the "cloud login" string is hard-coded into the error message so there's no way to know programmatically whether its referencing an actual command or not. It might be nice to build an abstraction for these links so they can be checked.

Static command tree checker

This is mostly for the non-TypeScript users, but it could also be very useful even for TypeScript users for example when auto-generating a command tree. Anyway, the feature would be a function checkCli or something like that. It would check the correctness of the command tree for types etc but also whether you have subcommands.length > 0 in branches and that kind of thing that isn't currently checked even by types.

Serve website as Node.js service

Right now cli.carnesen.com/examples does not work because it's being served by some Python 2.7 thing. Let's just serve the website as a Node.js service so we have total control. This will also give us flexibility in the future to do things like have browser terminal talking to a CLI on the host via websockets.

Stop exporting findCliNode

That API just isn't ready to be public. The consumer of that API in website can just require that module directly.

Add "features" section to readme.md

It would be nice if we had a list of features (hidden leaf, hidden command, multi-line comment, special errors, etc.) with links to specific examples especially with #86 .

File milestone and tickets for 0.5.0 release

  • Write up "Features" in readme.md
  • Fill out "Structure" in readme.md
  • Write examples/readme.md
  • ValuedParser --> ArgGroup : #58
  • Close alwayscli issues
  • Contact dependents and offer upgrade assistance

Define software maintenance schedule

Software projects should provide their users with clarity on the release and maintenance schedule. See Node.js for example. This task will be complete when we have defined our release and maintenance schedule.

Get initial "line" from URL query string

It would be super slick to get the initial "line" from the URL query string parameters so that we could link into the examples as live documentation for features.

Acknowledge MonoLisa and XTerm on website main page

Contractually MonaLisa must be acknowledged. XTerm.js is a pretty rad project too so let's thank them too. I imagine this being implemented as the same footer as the docs site, possibly even precisely that footer.

Live online examples at cli.carnesen.com

How cool would it be if we could get some live @carnesen/cli examples running in a browser app? Maybe we could run it in a browser directly. If that doesn't work for some reason, perhaps we could set up some kinda web socket situation and run the commands on the server and just have a terminal (e.g. xterm.js) running on the front end.

Build or find better way of pretty-printing arbitrary data to the browser console in `CliRepl`

In Node.js, console.log
pretty-prints the object to the terminal

In the the browser currently we have a very hacky way of handling that:

cli/website/src/cli-repl.ts

Lines 173 to 188 in 9d807d4

private consoleLog(arg: any) {
if (typeof arg === 'string') {
for (const ln of arg.split('\n')) {
this.terminal.writeln(ln);
}
} else if (typeof arg === 'number') {
this.terminal.writeln(yellow(String(arg)));
} else if (typeof arg === 'object' && typeof arg.stack === 'string') {
// Error object
for (const line of arg.stack.split('\n')) {
this.terminal.writeln(line);
}
} else {
this.terminal.writeln(String(arg));
}
}

This enhancement is to find or build a library for doing that pretty-printing for us in the browser.

Create `CliEmailArgGroup` factory

It's a pretty common requirement to provide an email address by command-line argument. Let's provide a factory for email arg groups with some validation built in.

  • CliEmailArgGroup: string-valued for a single email
  • CliEmailsArgGroup: string[]-values for multiple

Move CliRepl into main package and adapt it's API to be suitable for Node.js too

The CliRepl in the cli-website module has really worked out well. The autocompletion is super slick. That feature is worthy of promotion to the main module @carnesen/cli and it should be possible too since we only lightly use the Terminal interface from XTerm.js. To do so we need to make CliRepl pure dependency-free JavaScript and suitable for Node.js too. Probably it should just be an ordinary object factory too like CliBranch etc. instead of a class like it is today.

Use cases:

  • Browser: Dedicated browser CLIs like https://cli.carnesen.com
  • Node.js: my-cli repl: The CliRepl autocompletion is really good and useful even when we have productized shell autocompletion. There will be really slick things we can do in the custom REPL that wouldn't be possible in a normal shell REPL. Think of it like the mysql or redis-cli REPLs.

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.