Skip to content

Commit

Permalink
refactor(cli): moving binary target related files onto src/bin dir
Browse files Browse the repository at this point in the history
  • Loading branch information
bochaco committed Mar 26, 2024
1 parent d07f111 commit 497814f
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 51 deletions.
4 changes: 2 additions & 2 deletions sn_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ repository = "https://github.com/maidsafe/safe_network"
version = "0.89.85"

[[bin]]
path="src/main.rs"
path="src/bin/main.rs"
name="safe"

[lib]
path="src/lib/lib.rs"
path="src/lib.rs"
name="autonomi"

[[bench]]
Expand Down
File renamed without changes.
File renamed without changes.
21 changes: 9 additions & 12 deletions sn_cli/src/main.rs → sn_cli/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@
#[macro_use]
extern crate tracing;

mod cli;
mod subcommands;

use crate::{
cli::Opt,
subcommands::{
files::files_cmds,
folders::folders_cmds,
register::register_cmds,
wallet::{
hot_wallet::{wallet_cmds, wallet_cmds_without_client, WalletCmds},
wo_wallet::{wo_wallet_cmds, wo_wallet_cmds_without_client, WatchOnlyWalletCmds},
},
SubCmd,
use subcommands::{
files::files_cmds,
folders::folders_cmds,
register::register_cmds,
wallet::{
hot_wallet::{wallet_cmds, wallet_cmds_without_client, WalletCmds},
wo_wallet::{wo_wallet_cmds, wo_wallet_cmds_without_client, WatchOnlyWalletCmds},
},
Opt, SubCmd,
};

use bls::SecretKey;
use clap::Parser;
use color_eyre::Result;
Expand Down
File renamed without changes.
File renamed without changes.
29 changes: 28 additions & 1 deletion sn_cli/src/cli.rs → sn_cli/src/bin/subcommands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

use crate::subcommands::SubCmd;
pub(crate) mod files;
pub(crate) mod folders;
pub(crate) mod register;
pub(crate) mod wallet;

use clap::Parser;
use clap::Subcommand;
use color_eyre::Result;
use sn_logging::{LogFormat, LogOutputDest};
use sn_peers_acquisition::PeersArgs;
Expand Down Expand Up @@ -57,3 +62,25 @@ pub(crate) struct Opt {
#[clap(global = true, long = "no-verify", short = 'x')]
pub no_verify: bool,
}

#[derive(Subcommand, Debug)]
pub(super) enum SubCmd {
#[clap(name = "wallet", subcommand)]
/// Commands for a hot-wallet management.
/// A hot-wallet holds the secret key, thus it can be used for signing transfers/transactions.
Wallet(wallet::hot_wallet::WalletCmds),
#[clap(name = "wowallet", subcommand)]
/// Commands for watch-only wallet management
/// A watch-only wallet holds only the public key, thus it cannot be used for signing
/// transfers/transactions, but only to query balances and broadcast offline signed transactions.
WatchOnlyWallet(wallet::wo_wallet::WatchOnlyWalletCmds),
#[clap(name = "files", subcommand)]
/// Commands for file management
Files(files::FilesCmds),
#[clap(name = "folders", subcommand)]
/// Commands for folders management
Folders(folders::FoldersCmds),
#[clap(name = "register", subcommand)]
/// Commands for register management
Register(register::RegisterCmds),
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

mod audit;
pub(crate) mod helpers;
pub(crate) mod hot_wallet;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 0 additions & 36 deletions sn_cli/src/subcommands.rs

This file was deleted.

0 comments on commit 497814f

Please sign in to comment.