diff --git a/rust/agama-cli/src/server.rs b/rust/agama-cli/src/server.rs index 089701c9f7..636167bdf3 100644 --- a/rust/agama-cli/src/server.rs +++ b/rust/agama-cli/src/server.rs @@ -1,9 +1,9 @@ use clap::Subcommand; -use reqwest::header::{HeaderMap, CONTENT_TYPE, HeaderValue}; +use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE}; +use std::fs::File; use std::io; use std::io::{BufRead, BufReader}; -use std::fs::File; -use std::path::{PathBuf}; +use std::path::PathBuf; const DEFAULT_JWT_FILE: &str = "/tmp/agama-jwt"; const DEFAULT_AUTH_URL: &str = "http://localhost:3000/authenticate"; @@ -12,10 +12,10 @@ const DEFAULT_AUTH_URL: &str = "http://localhost:3000/authenticate"; pub enum ServerCommands { /// Login with defined server. Result is JWT stored and used in all subsequent commands Login { - #[clap(long, short = 'p')] - password: Option, - #[clap(long, short = 'f')] - file: Option, + #[clap(long, short = 'p')] + password: Option, + #[clap(long, short = 'f')] + file: Option, }, /// Release currently stored JWT Logout, @@ -24,10 +24,7 @@ pub enum ServerCommands { /// Main entry point called from agama CLI main loop pub async fn run(subcommand: ServerCommands) -> anyhow::Result<()> { match subcommand { - ServerCommands::Login { - password, - file, - }=> { + ServerCommands::Login { password, file } => { // actions to do: // 1) somehow obtain credentials (interactive, commandline, from a file) // credentials are handled in this way (in descending priority) @@ -42,12 +39,12 @@ pub async fn run(subcommand: ServerCommands) -> anyhow::Result<()> { }; login(LoginOptions::parse(options).password()?).await - }, + } ServerCommands::Logout => { // actions to do: // 1) release JWT from the well known location if any logout() - }, + } } }