Skip to content

Commit

Permalink
added schemas docs and add missing connections id doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jl-animo committed Mar 15, 2022
1 parent fc66df7 commit 9dcf65b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
20 changes: 19 additions & 1 deletion cli/src/help_strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub enum HelpStrings {

/// Connections
Connections,
ConnectionsId,
ConnectionsInvite,
ConnectionsInviteAutoAccept,
ConnectionsInviteAlias,
Expand Down Expand Up @@ -44,6 +45,14 @@ pub enum HelpStrings {
Message,
MessageId,
MessageMessage,

// Schema
Schema,
SchemaId,
SchemaCreate,
SchemaCreateName,
SchemaCreateVersion,
SchemaCreateAttributes,
}

impl From<HelpStrings> for Option<&str> {
Expand All @@ -65,6 +74,7 @@ impl HelpStrings {
HelpStrings::Environment => "Specify your current environment.",

HelpStrings::Connections => "Retrieve connections or create invitations",
HelpStrings::ConnectionsId => "ID of connection to retrieve",
HelpStrings::ConnectionsInvite => "Create a new connection invitation",
HelpStrings::ConnectionsInviteAlias => {
"The name a new connection will use to identify itself"
Expand Down Expand Up @@ -98,14 +108,22 @@ impl HelpStrings {
HelpStrings::CredentialsOfferValue => "????",
// TODO: What dis?
HelpStrings::CredentialsPropose => "????",
// TODO: What dis?
HelpStrings::CredentialsProposeId => "????",

HelpStrings::Features => "List all available features",

HelpStrings::Message => "Send a secure message to an exist connection",
HelpStrings::MessageId => "Connection ID to send the message to",
HelpStrings::MessageMessage => "Contents of the message",
// TODO: Add docs for all subcommands, e.g., ConnectionsAll.

HelpStrings::Schema => "Retrieve or create schemas",
HelpStrings::SchemaId => "ID of the schema to retrieve",
HelpStrings::SchemaCreate => "Create a new schema",
HelpStrings::SchemaCreateName => "Name of the schema",
HelpStrings::SchemaCreateVersion => "Version of of the schema, useful to be able to specify multiple versions of the same schema",
// TODO: What dis?
HelpStrings::SchemaCreateAttributes => "????",
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions cli/src/modules/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use log::{debug, info};
use crate::{
copy,
error::{Error, Result},
help_strings::HelpStrings,
utils::logger::pretty_print_obj,
utils::{
loader::{Loader, LoaderVariant},
Expand All @@ -13,8 +14,9 @@ use crate::{
};

#[derive(Args)]
#[clap(about = HelpStrings::Schema)]
pub struct SchemaOptions {
#[clap(long, short)]
#[clap(long, short, help=HelpStrings::SchemaId)]
pub id: Option<String>,

#[clap(subcommand)]
Expand All @@ -23,12 +25,13 @@ pub struct SchemaOptions {

#[derive(Subcommand, Debug)]
pub enum SchemaSubcommands {
#[clap(about = HelpStrings::SchemaCreate)]
Create {
#[clap(short, long)]
#[clap(short, long, help=HelpStrings::SchemaCreateName)]
name: String,
#[clap(short, long, default_value = "1.0")]
#[clap(short, long, help=HelpStrings::SchemaCreateVersion, default_value = "1.0")]
version: String,
#[clap(short, long)]
#[clap(short, long, help=HelpStrings::SchemaCreateAttributes)]
attributes: Vec<String>,
},
}
Expand Down

0 comments on commit 9dcf65b

Please sign in to comment.