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

Add indent option #23

Closed
brentonhouse opened this issue Aug 30, 2016 · 15 comments
Closed

Add indent option #23

brentonhouse opened this issue Aug 30, 2016 · 15 comments
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@brentonhouse
Copy link

brentonhouse commented Aug 30, 2016

Issuehunt badges

It would be nice to be able to control what is set to cursorTo in order to support indentation of rows, if desired.

yaodingyd earned $40.00 by resolving this issue!

@sindresorhus
Copy link
Owner

Can you show an example of what you're thinking?

@brentonhouse
Copy link
Author

brentonhouse commented Aug 30, 2016

I modified your code slightly to add:

   this.column = 0

and

  this.stream.cursorTo(this.column);

This allowed me to something like this:

        spinner.text = "Templating files";
        spinner.stopAndPersist(figures.arrowRight);
        spinner.column += 4;

        // the functions template_test and template_nativeloop set spinner text
        // and call succeed() when done.
        return Promise.all(_.map(['test.xml'], template_test))
            .then(() => Promise.all(_.map(['readme.md'], template_nativeloop)))
            .then(() => {
                spinner.column -= 4;
                return true;
            });

Giving me this result:

→ Installing template
    ✔ Checking for local template
    ✔ Installing template to temp directory
    ✔ Examining template
    ✔ Copying template to project folder
✔ Looking for workspace project folder
✔ Found workspace directory: /Users/me/Documents/Workspace
✔ Configuring package.json
→ Installing @nativeloop/mobile [skipped]
    → Directory already exists
✔ Running npm dedupe
→ Templating files
    ✔ Templating file: /Users/me/Documents/workspace/test.xml
    ✔ Templating file: /Users/me/Documents/workspace/readme.md
✔ Cleaning up temporary files

As a side note, I am also modifying it to add a function that accepts a title and promise (and then returns a promise). Not sure if that fits in w/ your vision for support for promises though...

@matheuss
Copy link
Contributor

I like it 😄 I'm cool with implementing it if @sindresorhus is ok with it – or to accept a PR if you would send it ☺️

@brentonhouse
Copy link
Author

I added PR: #24

@SamVerschueren
Copy link
Contributor

That looks a lot like listr.

@brentonhouse
Copy link
Author

brentonhouse commented Aug 30, 2016

It does :) I really like listr but behaviors like deleting all completed sub-tasks, don't fit my requirements. Using ora out-of-the box works very well and is actually a lot less coding. As soon as I finish adding Promises to ora, it will be even better!

@SamVerschueren
Copy link
Contributor

SamVerschueren commented Aug 30, 2016

No problem. I am refactoring the renderer part however which will let devs plugin their custom renderer. Keeping completed subtasks was asked for in the issue tracker.

SamVerschueren/listr#25

@brentonhouse
Copy link
Author

I saw that. I tried modifying the listr code but every change I made seemed to make things worse. Definitely place the blame for that on me and not on listr!

@SamVerschueren
Copy link
Contributor

Hehe :). I hope to ship the custom renderer part one of the following days. This will remove all the render related stuff from the tasks and let the renderer handle it. Hope to make things a little bit cleaner with this and add more renderers like this one and a verbose one. Will let you know when it is resolved. Although I'm not keeping you from implementing it on your own ;).

@brentonhouse
Copy link
Author

I will definitely use listr again! I am just making the ora output look like listr right now but not actually trying to recreate listr. My current code fits the purpose of what I was trying to accomplish but isn't reusable in any way. I hate when I have that...

@SamVerschueren
Copy link
Contributor

Listr now ships with custom renderers. The default renderer (listr-update-renderer) now also has the collapse flag which can be set to false.

@sindresorhus sindresorhus changed the title Export the cursor position to enable support for indentation Add indent option Feb 5, 2017
@satazor
Copy link

satazor commented May 15, 2017

For cross-reference, PR at #41

@ghost ghost mentioned this issue May 16, 2017
@brentonhouse
Copy link
Author

@SamVerschueren - I know this is an old request and this feature seems unlikely to ever get into ora. I did try listr and the indent works but because the collapse=false feature doesn't work, it shows but then disappears.

@IssueHuntBot
Copy link

@issuehuntfest has funded $40.00 to this issue. See it on IssueHunt

@IssueHuntBot
Copy link

@sindresorhus has rewarded $28.00 to @yaodingyd. See it on IssueHunt

  • 💰 Total deposit: $40.00
  • 🎉 Repository reward(20%): $8.00
  • 🔧 Service fee(10%): $4.00

@issuehunt-oss issuehunt-oss bot added the 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt label May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
Development

No branches or pull requests

6 participants