-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7af8c2
commit 55e3c1b
Showing
5 changed files
with
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS | ||
|
||
use clap::Args; | ||
use std::path::PathBuf; | ||
|
||
use libparsec::{get_default_config_dir, EntryName}; | ||
|
||
use crate::utils::*; | ||
|
||
#[derive(Args)] | ||
pub struct CreateWorkspace { | ||
/// Parsec config directory | ||
#[arg(short, long, default_value_os_t = get_default_config_dir())] | ||
config_dir: PathBuf, | ||
/// Device slughash | ||
#[arg(short, long)] | ||
device: Option<String>, | ||
/// New workspace name | ||
#[arg(short, long)] | ||
name: EntryName, | ||
} | ||
|
||
pub async fn create_workspace(create_workspace: CreateWorkspace) -> anyhow::Result<()> { | ||
let CreateWorkspace { | ||
config_dir, | ||
device, | ||
name, | ||
} = create_workspace; | ||
|
||
load_client_and_run(config_dir, device, |client| async move { | ||
let handle = start_spinner("Creating workspace"); | ||
|
||
client.user_ops.create_workspace(name).await?; | ||
|
||
handle.done(); | ||
|
||
println!("Workspace has been created"); | ||
|
||
Ok(()) | ||
}) | ||
.await | ||
} |
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
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