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

added feedback #592

Merged
merged 2 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cargo-shuttle/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ pub enum Command {
Login(LoginArgs),
/// run a shuttle service locally
Run(RunArgs),
/// Open an issue on github and provide feedback.
Feedback,
/// manage a project on shuttle
#[clap(subcommand)]
Project(ProjectCommand),
Expand Down
10 changes: 10 additions & 0 deletions cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ impl Shuttle {
Command::Init(init_args) => self.init(init_args, args.project_args).await,
Command::Generate { shell, output } => self.complete(shell, output).await,
Command::Login(login_args) => self.login(login_args).await,
Command::Feedback => self.feedback().await,
Command::Run(run_args) => self.local_run(run_args).await,
need_client => {
let mut client = Client::new(self.ctx.api_url());
Expand Down Expand Up @@ -225,6 +226,15 @@ impl Shuttle {
self.ctx.load_local(project_args)
}

/// Provide feedback on GitHub.
async fn feedback(&self) -> Result<()> {
let url = "https://github.com/shuttle-hq/shuttle/issues/new";
let _ = webbrowser::open(url);

println!("\nIf your browser did not open automatically, go to {url}");
Ok(())
}

/// Log in with the given API key or after prompting the user for one.
async fn login(&mut self, login_args: LoginArgs) -> Result<()> {
let api_key_str = match login_args.api_key {
Expand Down