Skip to main content

Cli

Struct Cli 

Source
pub struct Cli {
Show 34 fields pub base: PathBuf, pub name: Option<String>, pub hidden: bool, pub follow: bool, pub no_ignore: bool, pub validate: bool, pub list: bool, pub show: Option<PathBuf>, pub links: bool, pub new: Option<PathBuf>, pub init: bool, pub index: bool, pub log: Option<String>, pub set: Option<String>, pub script: Option<PathBuf>, pub dry_run: bool, pub fence: Option<String>, pub type_: Option<String>, pub title: Option<String>, pub description: Option<String>, pub tag: Vec<String>, pub log_kind: Option<String>, pub file: Option<PathBuf>, pub strict: bool, pub question: Option<String>, pub expect: Option<String>, pub emit: Option<String>, pub emit_stderr: Option<String>, pub quiet: bool, pub json: bool, pub json_pretty: bool, pub timeout: Option<f64>, pub heartbeat: HeartbeatOpts, pub explain: Option<Format>,
}

Fields§

§base: PathBuf

Bundle root (or single concept root) to operate on.

§name: Option<String>

Limit selection to files whose name matches; ‘|’-separated alternatives, each substring->glob->regex promoted and anchored.

§hidden: bool

Include dot-entries (names starting with ‘.’); default skips them.

§follow: bool

Follow symlinks while traversing.

§no_ignore: bool

Walk gitignored / .ignore files too (the .git directory is always skipped); by default the walk skips what git would.

§validate: bool

Check the bundle for OKF conformance and report a verdict (the default verb when no other is given).

§list: bool

List the bundle’s concepts with their metadata; filter with –type / –tag.

§show: Option<PathBuf>

Show one concept’s frontmatter (give the concept path).

§links: bool

Report the bundle’s cross-links; with –strict, fail on a broken bundle-relative link.

§new: Option<PathBuf>

Scaffold a new concept at PATH (requires –type); refuses to overwrite.

§init: bool

Scaffold a bundle root index.md (declaring okf_version) if absent.

§index: bool

(Re)generate index.md for –base from the concepts’ frontmatter.

§log: Option<String>

Prepend a dated entry to the bundle’s log.md (use –log-kind to label it).

§set: Option<String>

Set or update a frontmatter field on the –file concept: FIELD=VALUE.

§script: Option<PathBuf>

Run a .ctb script of new/set/log/index/init items atomically: simulate the whole batch, write only if every op succeeds.

§dry_run: bool

With –script: simulate and print the plan, but write nothing.

§fence: Option<String>

With –script: the directive prefix for script lines (default “#%”).

§type_: Option<String>

The concept type for –new; also filters –list to this type.

§title: Option<String>

With –new: the concept title.

§description: Option<String>

With –new: the concept description (one sentence).

§tag: Vec<String>

With –new: tags (comma-separated); also filters –list to concepts carrying all given tags.

§log_kind: Option<String>

With –log: the entry label (e.g. Update, Creation). Default: Update.

§file: Option<PathBuf>

With –set: the concept file to edit.

§strict: bool

With –validate / –links: also treat broken bundle-relative links as failures.

§question: Option<String>

Question this check answers, framing it as a test; printed as a “== … ==” banner unless –quiet.

§expect: Option<String>

Verdict expectation over the violation count: any|none|N|=N|+N|-N. Default: none (every concept conforms / no broken links).

§emit: Option<String>

Template written to stdout after a check. Tokens: {RESULT} {QUESTION} {COUNT} {TOTAL} {BASE} {MATCHES} ({COUNT} is the violation count).

§emit_stderr: Option<String>

Template written to stderr after a check (same tokens as –emit).

§quiet: bool

Suppress informational output; report via exit status (and –emit, which still fires).

§json: bool

Emit a structured JSON result instead of text.

§json_pretty: bool

Like --json, but pretty-printed (indented).

§timeout: Option<f64>

Abort with exit 2 if the run exceeds SECS seconds (fractional allowed).

§heartbeat: HeartbeatOpts§explain: Option<Format>

Print agent usage docs (md or json) and exit.

Trait Implementations§

Source§

impl Args for Cli

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

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

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

fn augment_args_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§

impl CommandFactory for Cli

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 Cli

Source§

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

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

impl FromArgMatches for Cli

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( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Cli

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

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

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

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

Parse from iterator, exit on error.
Source§

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.
Source§

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

Update from iterator, exit on error. Read more
Source§

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.

Auto Trait Implementations§

§

impl Freeze for Cli

§

impl RefUnwindSafe for Cli

§

impl Send for Cli

§

impl Sync for Cli

§

impl Unpin for Cli

§

impl UnsafeUnpin for Cli

§

impl UnwindSafe for Cli

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
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.