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 "Undo" functionality #6

Open
joshwcomeau opened this issue Sep 6, 2017 · 3 comments
Open

Add "Undo" functionality #6

joshwcomeau opened this issue Sep 6, 2017 · 3 comments

Comments

@joshwcomeau
Copy link
Owner

joshwcomeau commented Sep 6, 2017

Often, I'll realize right after creating a component that I did it wrong.

Maybe I meant to make a functional component, but forgot the flag. Maybe I realized it has the wrong name (or I typo'ed the name).

Right now the solution is rm -rf src/components/ThingYouJustCreated, which is a little burdensome, and I worry I might make a mistake with that and delete the wrong thing.

I think it'd be neat if you could do:

$ new-component-undo

This will delete the component 'ThingYouJustCreated`. 
Press enter to continue, or any other key to cancel.
@morajabi
Copy link
Collaborator

morajabi commented Sep 6, 2017

I was thinking for something like this: new-component undo. What do you think?

@joshwcomeau
Copy link
Owner Author

I was thinking for something like this: new-component undo. What do you think?

Hmm... Yeah, I like that!

The "keyword" is typically the name of the component, but if you wanted to make an undo component, it needs to be capitalized as Undo. So I think a case-sensitive undo command makes sense.

@jelly8173
Copy link

You need to be consistent with flags.

In new-component undo the function of undo is to specify a command. Then I can infer that general syntax for utility is like new-component create Something?

I suggest makeing -u flag as an alternative. Usually when you notice error, you still able to reach that terminal, where you issued command to create component, so you can just type ↑ (or ^P) to bring previous command back and add -u flag yielding something like: new-component Something -u.

That way you can be sure that name is consistent with erroneously created one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants