Comments (2)
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.
Hi @rafaelcamargo, thanks it helps! I had to use  
for the promptString
parameter and now it works as expected!
from glorious-demo.
Related Issues (20)
- Add possibility to customize typing speed
- change the style of the cursor HOT 1
- Allow multiple independent editors. HOT 4
- Automatically scroll if text exceeds the bounds of the text box HOT 1
- Reveal code manually, one line at a time. HOT 1
- HTML vs Plain Text Handling HOT 5
- Make .end() return a promise
- Create a method to close some application
- Create a method to clear terminal content HOT 1
- Is it for programming video teaching video tutorial? HOT 2
- Issue with character escaping when using Prism HOT 3
- Animaton start HOT 6
- Extendable API HOT 6
- Allow users to edit the existing typed code in the editor HOT 1
- Allow to open an application with some content already typed
- write() doesn't honor code highlighted with Prism HOT 2
- Add possibility to open an application without window animation HOT 1
- Span height issue creating mini vertical scroll HOT 4
- Support soft-wrap feature HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glorious-demo.