Skip to content

Commit

Permalink
rad-exe: intergate rad-profile
Browse files Browse the repository at this point in the history
We add the rad-profile Args to the subcommands of rad-exe allowing the
binary to call into the rad-profile functionality.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
  • Loading branch information
FintanH committed Sep 6, 2021
1 parent af4db15 commit aa94d58
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
8 changes: 8 additions & 0 deletions rad-exe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ structopt = "0.3"

[dependencies.librad]
path = "../librad"

[dependencies.rad-profile]
path = "../rad-profile"

[dependencies.thrussh-agent]
git = "https://github.com/FintanH/thrussh"
branch = "generic-agent"
default-features = false
2 changes: 2 additions & 0 deletions rad-exe/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@

pub mod args;
pub mod main;

pub use main::main;
5 changes: 2 additions & 3 deletions rad-exe/src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ pub struct Args {

#[derive(Debug, StructOpt)]
pub enum Command {
/// This is just a stub, sshhhh
// TODO(finto): Fill in core commands
Profile,
/// Manage your Radicle profiles
Profile(rad_profile::cli::args::Args),
#[structopt(external_subcommand)]
External(Vec<String>),
}
Expand Down
11 changes: 6 additions & 5 deletions rad-exe/src/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ use std::{
};

use structopt::StructOpt;
use thrussh_agent::client::ClientStream;

use super::args::{self, sanitise_globals, Args};

pub fn main() -> anyhow::Result<()> {
pub async fn main<S>() -> anyhow::Result<()>
where
S: ClientStream + Unpin + 'static,
{
let args = sanitise_globals(Args::from_args());
match args.command {
args::Command::Profile => {
println!("whoops, this is in beta");
Ok(())
},
args::Command::Profile(args) => rad_profile::cli::main::<S>(args).await,
args::Command::External(external) => {
let exe = external.first();
match exe {
Expand Down

0 comments on commit aa94d58

Please sign in to comment.