iroh_docs::cli

Enum DocCommands

Source
pub enum DocCommands {
Show 15 variants Switch { id: NamespaceId, }, Create { switch: bool, }, Join { ticket: DocTicket, switch: bool, }, List, Share { doc: Option<NamespaceId>, mode: ShareMode, addr_options: AddrInfoOptions, }, Set { doc: Option<NamespaceId>, author: Option<AuthorId>, key: String, value: String, }, DlPolicy(DlPolicyCmd), Get { doc: Option<NamespaceId>, key: String, prefix: bool, author: Option<AuthorId>, mode: DisplayContentMode, }, Del { doc: Option<NamespaceId>, author: Option<AuthorId>, prefix: String, }, Keys { doc: Option<NamespaceId>, author: Option<AuthorId>, prefix: Option<String>, sort: Sorting, desc: bool, mode: DisplayContentMode, }, Import { doc: Option<NamespaceId>, author: Option<AuthorId>, prefix: Option<String>, path: String, in_place: bool, no_prompt: bool, }, Export { doc: Option<NamespaceId>, key: String, out: String, }, Watch { doc: Option<NamespaceId>, }, Leave { doc: Option<NamespaceId>, }, Drop { doc: Option<NamespaceId>, },
}
Available on crate feature cli only.
Expand description

Possible Document commands.

Variants§

§

Switch

Set the active document (only works within the Iroh console).

Fields

§

Create

Create a new document.

Fields

§switch: bool

Switch to the created document (only in the Iroh console).

§

Join

Join a document from a ticket.

Fields

§ticket: DocTicket
§switch: bool

Switch to the joined document (only in the Iroh console).

§

List

List documents.

§

Share

Share a document with peers.

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

§mode: ShareMode

The sharing mode.

§addr_options: AddrInfoOptions

Options to configure the address information in the generated ticket.

Use relay-and-addresses in networks with no internet connectivity.

§

Set

Set an entry in a document.

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

§author: Option<AuthorId>

Author of the entry.

Required unless the author is set through the IROH_AUTHOR environment variable. Within the Iroh console, the active author can also set with author switch.

§key: String

Key to the entry (parsed as UTF-8 string).

§value: String

Content to store for this entry (parsed as UTF-8 string)

§

DlPolicy(DlPolicyCmd)

Set the download policies for a document.

§

Get

Get entries in a document.

Shows the author, content hash and content length for all entries for this key.

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

§key: String

Key to the entry (parsed as UTF-8 string).

§prefix: bool

If true, get all entries that start with KEY.

§author: Option<AuthorId>

Filter by author.

§mode: DisplayContentMode

How to show the contents of the key.

§

Del

Delete all entries below a key prefix.

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

§author: Option<AuthorId>

Author of the entry.

Required unless the author is set through the IROH_AUTHOR environment variable. Within the Iroh console, the active author can also set with author switch.

§prefix: String

Prefix to delete. All entries whose key starts with or is equal to the prefix will be deleted.

§

Keys

List all keys in a document.

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

§author: Option<AuthorId>

Filter by author.

§prefix: Option<String>

Optional key prefix (parsed as UTF-8 string)

§sort: Sorting

How to sort the entries

§desc: bool

Sort in descending order

§mode: DisplayContentMode

How to show the contents of the keys.

§

Import

Import data into a document

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also be set with doc switch.

§author: Option<AuthorId>

Author of the entry.

Required unless the author is set through the IROH_AUTHOR environment variable. Within the Iroh console, the active author can also be set with author switch.

§prefix: Option<String>

Prefix to add to imported entries (parsed as UTF-8 string). Defaults to no prefix

§path: String

Path to a local file or directory to import

Pathnames will be used as the document key

§in_place: bool

If true, don’t copy the file into iroh, reference the existing file instead

Moving a file imported with in-place will result in data corruption

§no_prompt: bool

When true, you will not get a prompt to confirm you want to import the files

§

Export

Export the most recent data for a key from a document

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also be set with doc switch.

§key: String

Key to the entry (parsed as UTF-8 string)

When just the key is present, will export the latest entry for that key.

§out: String

Path to export to

§

Watch

Watch for changes and events on a document

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

§

Leave

Stop syncing a document.

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

§

Drop

Delete a document from the local node.

This is a destructive operation. Both the document secret key and all entries in the document will be permanently deleted from the node’s storage. Content blobs will be deleted through garbage collection unless they are referenced from another document or tag.

Fields

§doc: Option<NamespaceId>

Document to operate on.

Required unless the document is set through the IROH_DOC environment variable. Within the Iroh console, the active document can also set with doc switch.

Implementations§

Source§

impl DocCommands

Source

pub async fn run( self, docs: &Client, blobs: &Client, env: &ConsoleEnv, ) -> Result<()>

Runs the document command given the iroh client and the console environment.

Trait Implementations§

Source§

impl Clone for DocCommands

Source§

fn clone(&self) -> DocCommands

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CommandFactory for DocCommands

Source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
Source§

impl Debug for DocCommands

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for DocCommands

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for DocCommands

§

fn parse() -> Self

Parse from std::env::args_os(), [exit][Error::exit] on error.
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, [exit][Error::exit] on error.
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, [exit][Error::exit] on error. Read more
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.
Source§

impl Subcommand for DocCommands

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T