-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement
auth
command in xlinectl
Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
187 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use clap::{ArgMatches, Command}; | ||
use xline_client::{error::Result, Client}; | ||
|
||
use crate::utils::printer::Printer; | ||
|
||
/// Definition of `disable` command | ||
pub(super) fn command() -> Command { | ||
Command::new("disable").about("disable authentication") | ||
} | ||
|
||
/// Execute the command | ||
pub(super) async fn execute(client: &mut Client, _matches: &ArgMatches) -> Result<()> { | ||
let resp = client.auth_client().auth_disable().await?; | ||
resp.print(); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use clap::{ArgMatches, Command}; | ||
use xline_client::{error::Result, Client}; | ||
|
||
use crate::utils::printer::Printer; | ||
|
||
/// Definition of `enable` command | ||
pub(super) fn command() -> Command { | ||
Command::new("enable").about("Enable authentication") | ||
} | ||
|
||
/// Execute the command | ||
pub(super) async fn execute(client: &mut Client, _matches: &ArgMatches) -> Result<()> { | ||
let resp = client.auth_client().auth_enable().await?; | ||
resp.print(); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use clap::{ArgMatches, Command}; | ||
use xline_client::{error::Result, Client}; | ||
|
||
use crate::handle_matches; | ||
|
||
/// Auth disable command | ||
mod disable; | ||
/// Auth enable command | ||
mod enable; | ||
/// Auth status command | ||
mod status; | ||
|
||
/// Definition of `auth` command | ||
pub(crate) fn command() -> Command { | ||
Command::new("auth") | ||
.about("Manage authentication") | ||
.subcommand(enable::command()) | ||
.subcommand(disable::command()) | ||
.subcommand(status::command()) | ||
} | ||
|
||
/// Execute the command | ||
pub(crate) async fn execute(mut client: &mut Client, matches: &ArgMatches) -> Result<()> { | ||
handle_matches!(matches, client, {enable, disable, status}); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use clap::{ArgMatches, Command}; | ||
use xline_client::{error::Result, Client}; | ||
|
||
use crate::utils::printer::Printer; | ||
|
||
/// Definition of `status` command | ||
pub(super) fn command() -> Command { | ||
Command::new("status").about("Status of authentication") | ||
} | ||
|
||
/// Execute the command | ||
pub(super) async fn execute(client: &mut Client, _matches: &ArgMatches) -> Result<()> { | ||
let resp = client.auth_client().auth_status().await?; | ||
resp.print(); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/// Auth command | ||
pub(crate) mod auth; | ||
/// Delete command | ||
pub(crate) mod delete; | ||
/// Get command | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters