question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Examples to CLI

See original GitHub issue

I’ve got some examples so far, but most of them are more ‘unit tests’ to make sure it all works.

It would be great if the CLI could run a “Example Viewer” mode before generating a new sketch. Such as:

canvas-sketch --new --examples

The browser will list a thumbnail grid with examples, and clicking one will generate it from the template and start the server on that file.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
mattdeslcommented, Jun 30, 2018

I’ve started stubbing out a very basic Preact frontend that holds some of the examples. The feature/website branch has some of that work-in-progress.

You can test it here: https://competent-beaver-2ad4cc.netlify.com/

screen shot 2018-06-29 at 10 36 33 pm screen shot 2018-06-29 at 10 36 36 pm

I haven’t bothered with any fancy design yet – will likely do a generative/interactive Canvas background using canvas-sketch itself.

While doing this, I’m realizing it’s really awesome to have a “sketchbook” that can collect all the sketches in a single folder, and most of the code I’m writing for the website could be pulled into the canvas-sketch-cli tool as well. For example, canvas-sketch foo.js could run a single sketch, or canvas-sketchbook src/*.js could wrap all the sketches in src/ folder with a similar interface as in the website. The sketchbook (during dev) could easily have a “Add New Sketch” button (WebSockets that connect to node server) and some other handy features.

Still figuring out the best way to structure all that – ideally it should be re-usable enough that the canvas-sketch website itself can use the canvas-sketch-cli… 😄

1reaction
mattdeslcommented, Jun 23, 2018

Thanks!

I think the online Examples viewer will show code + result, but also a “Copy Code” button that simply copies it to clipboard.

The tool should already be ready to accept clipboard contents (and install any dependencies) like this:

# create a new folder to hold sketches
mkdir my-sketch
cd my-sketch

# generate a new sketch from clipboard contents
pbpaste | canvas-sketch -n
Read more comments on GitHub >

github_iconTop Results From Across the Web

Command Line Interface (CLI) Examples - Globus Docs
The following examples are all written for a Bash shell. If you are running another shell you may need to modify the non...
Read more >
How to Add CLI command to Connect applications
To add new CLI command first open AppBuilder (it opens automatically when new project created) and switch to the Printing tab. In the...
Read more >
Let's Build a CLI | Command Line Interface Tutorial by ...
To start, when we say "CLI" or "command line utility," we're talking about a program that we can run at the command line...
Read more >
What is a command-line interface (CLI)? - TechTarget
What is a command-line interface? A command-line interface (CLI) is a text-based user interface (UI) used to run programs, manage computer files and ......
Read more >
Build Command-Line Interfaces With Python's argparse
To add arguments and options to an argparse CLI, you'll use the .add_argument() method of your ArgumentParser instance. Note that the method is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found