GithubHelp home page GithubHelp logo

Comments (2)

rafaelcamargo avatar rafaelcamargo commented on May 16, 2024

Hey @gphilipp! Thanks for your compliment! I really appreciate that. 🙂

When I was coding Glorious Demo, I spent some time thinking how would be the best way to accomplish multi-line commands. At the time, I decided that using one .command() for each line would be the best way to offer all the flexibility someone might want. And when I say flexibility, I mean customizing the promptString for every command line, for example. Reflecting now about the decision made some time ago, I have the impression that writing multiples .command() made the API not as intuitive as it should be (Sorry!). Perhaps I'll try to improve this in the upcoming versions. However, for now, you can just write your script like follows:

const demo = new GDemo('#demo-container');

demo
  .openApp('terminal', {
    minHeight: '350px',
    windowTitle: 'terminal',
    onCompleteDelay: 1000,
    promptString: '$'
  })
  .command('curl \\')
  .command('http://localhost:8008 \\', { promptString: '>' })
  .command('--request POST \\')
  .command('--header "Content-Type: application/json" \\')
  .command('--data \'{"status": "ok"}\'', { onCompleteDelay: 500 })
  .respond('OK')
  .command('', { promptString: '$' })
  .end();

Here's a Gist all the necessary code to run the above example: https://gist.github.com/rafaelcamargo/02a8a9fc00f5ca9bb6a3494cb5e95e2e

Hope it helps!

from glorious-demo.

gphilipp avatar gphilipp commented on May 16, 2024

Hi @rafaelcamargo, thanks it helps! I had to use &nbsp for the promptString parameter and now it works as expected!

from glorious-demo.

Related Issues (20)

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.