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

feat: Rename project new/rm to start/stop, add restart + other args fixes #771

Merged
merged 5 commits into from
Apr 4, 2023

Conversation

jonaro00
Copy link
Member

Description of change

  • Capitalize and clarify all argument descriptions
  • Rename new/rm to start/stop: Why? The "rm" implies that something is deleted, which confuses some. Other suggestions for names are accepted. "create/destroy" instead? recreate doesn't sound as good as restart :/
  • Add cargo shuttle project restart (stop+start), since this is and has been a very commonly recommended operation (We will save so many keystrokes in Discord 🤠)
  • Let cargo shuttle project list be run whether in a Cargo project or not

How Has This Been Tested (if applicable)?

Tested against production. The restart command works as expected from both running and stopped states.

Copy link
Contributor

@chesedo chesedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these @jonaro00! 🥳 I just have one comment about the use of bail!

@@ -68,7 +68,13 @@ impl Shuttle {
Command::Deploy(..)
| Command::Deployment(..)
| Command::Resource(..)
| Command::Project(..)
| Command::Project(
// ProjectCommand::List does not need to know which project we are in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 😍

@@ -366,7 +375,7 @@ impl Shuttle {
if let Some(deployment) = summary.deployment {
deployment.id
} else {
return Err(anyhow!("could not automatically find a running deployment for '{}'. Try passing a deployment ID manually", self.ctx.project_name()));
bail!("Could not automatically find a running deployment for '{}'. Try passing a deployment ID manually", self.ctx.project_name());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't quite remember, but doesn't return Err(...) make the format of the error better by catching the Err somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://docs.rs/anyhow/latest/anyhow/macro.bail.html

This macro is equivalent to return Err(anyhow!($args...)).

I'd be surprised if that actually affected formatting 🧐

Copy link
Contributor

@oddgrd oddgrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this was overdue! 🙏 We also need to update the instances where project new/rm is documented in this repo (readme, contributing), as well as the docs. We can also do that if you don't have time, of course, but it might be a bit delayed.

@jonaro00
Copy link
Member Author

jonaro00 commented Apr 3, 2023

@oddgrd
Copy link
Contributor

oddgrd commented Apr 4, 2023

Terrific, thanks @jonaro00! ❤️

@oddgrd oddgrd merged commit 629ac8c into shuttle-hq:main Apr 4, 2023
@jonaro00 jonaro00 deleted the feat/start-stop-restart branch April 4, 2023 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants