Skip to main content

Command

Enum Command 

Source
pub enum Command {
Show 30 variants Init { folder: Option<PathBuf>, message: Option<String>, yes: bool, name: Option<String>, device: Option<String>, passphrase: bool, languages: Option<Languages>, join: Option<PairingCode>, secrets: bool, allow_fat: bool, }, Languages { ranges: Option<String>, device: bool, app: bool, clear: bool, }, Status { library_wide: bool, secrets: bool, }, Verify { export: Option<PathBuf>, drive_checked: bool, }, New { kind: String, values: Vec<String>, language: Option<Tag>, }, Show { entity: String, on: Option<Day>, as_of: Option<Moment>, }, Move { entity: String, to: String, without_history: bool, keep_behind: bool, leave_secrets: bool, yes: bool, }, Merge { entity: String, other: Option<String>, undo: bool, }, Export { folder: PathBuf, current: bool, }, Import { paths: Vec<PathBuf>, from: Option<String>, }, History { entity: String, field: Option<String>, }, Edit(EditArgs), Purge { entity: Option<String>, value: Option<String>, behind: bool, yes: bool, }, Find { words: Vec<String>, all: bool, }, List { kind: Option<String>, conditions: Vec<String>, sort: Option<String>, on: Option<Day>, }, Type { command: TypeCommand, }, File { command: FileCommand, }, Trees(TreeCommand), Protect { passphrase: bool, secrets: bool, }, Secret { command: SecretCommand, }, Policy { command: PolicyCommand, }, Space { command: SpaceCommand, }, Device { command: DeviceCommand, }, Backup { command: BackupCommand, }, Recovery { command: RecoveryCommand, }, Purges { command: Option<PurgesCommand>, }, Sync { serve: bool, wait: u64, at_login: Option<Switch>, port: u16, }, Pull { wait: u64, partial: bool, clone: bool, no_clone: bool, }, Mcp { action: McpAction, }, Absent(Absent),
}
Expand description

What nib can do.

Variants§

§

Init

Makes a library, once on each computer, or a folder in one a tree.

Where no library is found, in the folders it is in, or named by –library or NIBKEEP_LIBRARY, makes the current folder, or the one –library names, a library: you as its user, named after your account on this computer, as whoami prints it, or as –name says, linked to a person with your full name, if the system knows it, this device, and a personal space. The library keeps them in the folder .nib; the rest of the folder is yours, for your files. With –join, makes it a copy of a library you have on another device instead: there, nib device pair shows the code to give. A library is brought back with nib recovery restore.

In a library’s folder, or with the library that –library or NIBKEEP_LIBRARY names, makes the current folder, or the one given, a tree, as git init does: NibKeep keeps every version of its files, by their paths, and nib commit records them. The folder given may be anywhere: its own library, if it is in one, or else the current folder’s, keeps it. A tree’s folder outside the library’s gets a file .nib that names the library, by which nib finds it there; for a tree that lost the file, init writes it again. Its files become the tree’s copies, committed as its first revision: a purge of a file’s content deletes its copy where it was not edited, so it asks first. What .nibignore files name is left out, in Git’s syntax for .gitignore, and always .nib, every .git, and the inside of folders that hold Git repositories. A tree is never inside another, nor started in a folder that holds a Git repository. Files such as .env and private keys, and what .nibsecret files name, go in as secret files, sealed for the secrets, whose passphrase it asks for, or sets up.

Fields

§folder: Option<PathBuf>

The folder to make a tree; without it, the current one.

§message: Option<String>

The message of the tree’s first revision.

§yes: bool

Makes the folder a tree without asking.

§name: Option<String>

Your own name, such as Ada Lovelace, not the library’s, which is its folder’s: you become the library’s user, linked to a person of that name. Without it, your account’s name, as whoami prints it, and your full name for the person, if the system knows it. Giving it makes a library.

§device: Option<String>

This device’s name, instead of the computer’s. Giving it makes a library.

§passphrase: bool

Protects the library’s keys with a passphrase instead of the platform’s keystore. Giving it makes a library.

§languages: Option<Languages>

The languages you read, ranked, such as en, *-Latn, ru: English first, then anything in the Latin script, then Russian. Without it, the system’s. Giving it makes a library.

§join: Option<PairingCode>

Joins the library of another device of yours, which shows this code: nib device pair shows it there. Both devices must be on the same network.

§secrets: bool

With –join, asks the device that shows the code for the library’s secrets too, with a passphrase of their own here, asked for twice before the code is used. It gives them if its secrets are unlocked, as nib device pair –give-secrets does; otherwise nib secret give does there later.

§allow_fat: bool

Keeps the library on this drive although its file system keeps no journal, as FAT32 and exFAT, which most USB sticks have. There, a drive removed without ejecting it, or that loses its power, while the library is open, must be checked for errors before the library is used again: nib says so then. Giving it makes a library.

§

Languages

Shows or sets the languages that values are shown in.

The languages are ranked, such as en, *-Latn, ru. This app’s list comes before this device’s, and this device’s before yours.

Fields

§ranges: Option<String>

The languages, ranked. Without them, shows the lists.

§device: bool

Sets this device’s list, for every app on it, instead of yours.

§app: bool

Sets this app’s list instead of yours.

§clear: bool

Clears the list, so that the next one counts.

§

Status

Shows what changed in the tree here, or what the library holds.

In a tree’s folder, shows what changed in the tree’s copy here since it was written or committed: new, edited, moved and deleted files, and executable bits, and the Git repositories found, with the work they hold that their remotes lack; and what changed in the tree elsewhere. Only the files whose size or modification time changed are read. Elsewhere, or with –library-wide, shows what the library holds.

Fields

§library_wide: bool

Shows what the library holds, in a tree’s folder too.

§secrets: bool

Lists the tree’s secret files instead, which only devices that hold the secrets read or write, and its ordinary files that look secret, as files committed before a rule named them, or taken in as ordinary.

§

Verify

Checks every change, log file and readable file of the library.

Every blob this device can read is read in full. Fails if anything is wrong.

Fields

§export: Option<PathBuf>

Checks an export instead: every file against its sums, and what it holds against what the library held at its moment.

§drive_checked: bool

Says that the library’s drive was checked for errors, as by Windows’ Scan and fix or by fsck, after it was removed without ejecting it, or lost its power, while the library was open; then verifies the whole library.

§

New

Adds an entity of a type, with its values.

Its values are given as field=value, such as nib new book name="Leviathan Wakes" published=2011.

Fields

§kind: String

Its type, or several separated by commas, such as edition,audiobook. A name without a dot is your own type of that name, or else the only known type whose name ends in it.

§values: Vec<String>

Its values, as field=value. Give a field with many values several times.

§language: Option<Tag>

The language of its text, names and files, such as en or uk-Latn, except for fields of codes, such as ISBNs, which are in no language.

§

Show

Shows an entity, found by its ID, a prefix of its ID, or its name.

Fields

§entity: String

The entity.

§on: Option<Day>

Shows the entity as it was on this day, such as 2000-01-01, instead of today.

§as_of: Option<Moment>

Shows the entity as the library had recorded it by then, without the changes made since: a day, such as 2026-10-10, which means its end, or a moment, such as 2026-10-10T20:00, in local time unless it gives its offset from UTC. Without –on, as it was on that day.

§

Move

Moves an entity to another space, such as one you share.

A new entity there gets its values, with their history as you carry it, its types and its files, and links to it lead there. A folder or a list moves with all it holds, through every level, which nib lists first. The old space keeps the history it had, for those who can read it.

Fields

§entity: String

The entity, by its ID, the start of its ID, or its name.

§to: String

The space to move it to, by its name or the start of its ID.

§without_history: bool

Brings its current values alone, and leaves its history in the old space.

§keep_behind: bool

Keeps what it leaves in the old space. Otherwise that is purged once another device, yours or another member’s, holds what moved: what your role there lets you purge, and the rest once an admin of that space purges it.

§leave_secrets: bool

Leaves its secret values, such as passwords, with it in the old space, where no purge of what stays behind takes them. Otherwise they move too, which needs the secrets of both spaces, unlocked as it moves.

§yes: bool

Moves a folder or a list with all it holds, or an entity out of the folders and lists that stay, which nib otherwise only lists.

§

Merge

Merges an entity into another that it turns out to be the same as.

The other shows what both say from then on, and references to either lead to it. With –undo, sets apart again an entity merged into ENTITY: the only one, or the one given.

Fields

§entity: String

The entity.

§other: Option<String>

The entity to merge it into, or with –undo, the entity merged into it to set apart, by its ID, a prefix of its ID, or its own name.

§undo: bool

Undoes a merge.

§

Export

Exports the library into a folder, as JSON, files and their sums.

The folder, empty or new, gets the library’s entities as JSON, the files they refer to as they were added, and the SHA-256 sums of them all, which read without NibKeep. The folder is not encrypted, and secret values are left out.

Fields

§folder: PathBuf

The folder.

§current: bool

Only the values entities have now, without their history, who recorded them or when, without deleted entities and the records of users and devices: for giving a collection to someone.

§

Import

Imports an export of a library, or Google Takeout’s photos.

A folder that nib export made brings what it holds and the library lacks, with the same IDs, so that importing it again adds nothing. Its records of users, devices, replicas and spaces are left out, and an export whose sums do not match is refused.

Anything else is taken for Google Takeout’s archive of Google Photos: its parts, zip or tgz files, all at once, or the folder one was unpacked into, read where they are. Each photo and video comes with what its JSON file says, when and where it was taken and its description, in place of what it says of itself, as that is where corrections made in Google Photos are; its name as uploaded; and in a folder for each album it is in, inside a folder named after the source. A photo the library holds already, as from a phone, is stored once, found in one more place. Other products of the archive, as Drive, are left out. Imported again, what an import added is not read again, so one cut short goes on where it stopped.

Fields

§paths: Vec<PathBuf>

The folder of the export; or the parts of Takeout’s archive, or the folder it was unpacked into.

§from: Option<String>

The source of Takeout’s photos, by a name of yours: Google Photos unless given, such as Google Photos (Mom).

§

History

Shows every value an entity has had, or one field’s.

Each value comes with when it was recorded, by whom, and when it was replaced.

Fields

§entity: String

The entity.

§field: Option<String>

The field.

§

Edit(EditArgs)

Changes an entity’s values or types.

field=value sets a field, correcting the value it shows; field+=value adds a value, which with --date records a change, such as a new employer, that ends the value before it in a field with one value; field-=value removes a value; and field= clears the field. type+=TYPE gives the entity another type, and type-=TYPE takes one away; its values stay. Where a type of the entity has a field named type, org.nibkeep.type+= and -= change the types.

§

Purge

Purges values for good, everywhere, with their history.

field=value purges that value of an entity, current or past, and field= every value the field has held. What else the changes that held them held stays, and what they replaced stays replaced. Without –yes, it says what it would purge, and purges nothing. With –behind and no entity, lists what moves left behind and asked you to purge, as an admin of its space.

Fields

§entity: Option<String>

The entity.

§value: Option<String>

What to purge, as field=value or field=.

§behind: bool

Purges what a move left behind of the entity, as its mover asked: as an admin of its space, all but the marks that lead to where it is now; as an editor, the changes you signed.

§yes: bool

Purges for good, which cannot be undone.

§

Find

Finds the entities whose values hold every word.

The last word also matches the start of a longer one. Then, through links, what they lead to: the books of an author they are, a pen name they use, and the books credited to it. Lists the first 50 of each space and says how many more there are.

Fields

§words: Vec<String>

The words.

§all: bool

Lists every entity found, not only the first 50.

§

List

Lists the entities, or those of a type.

They are listed by name or in the order of a field, such as nib list book --where in-series="The Expanse" --sort number-in-series. A field is one of the type’s, or else of the other types that its entities have, as an audiobook can be an edition too; which one a short name finds can change with the entities, so scripts give full names, such as std.published.

Fields

§kind: Option<String>

The type.

§conditions: Vec<String>

Lists only the entities whose field shows this value today. A reference is given by the ID, the start of the ID or the name of what it refers to. Give it several times for entities that meet every condition.

§sort: Option<String>

Orders the entities by the first value the field shows: numbers by size, dates by when they start, text and names alphabetically, references by the names of what they refer to. Entities without a value come last.

§on: Option<Day>

Lists the entities as they were on this day, such as 2000-01-01, instead of today: by the names they had then, and the values their fields showed then.

§

Type

Works with types: the fields that entities of a type may have.

Fields

§command: TypeCommand

What to do with types.

§

File

Works with files, each stored once with every place it was found.

A file’s content is stored once, however often it is added.

Fields

§command: FileCommand

What to do with files.

§

Trees(TreeCommand)

The commands of trees, named as other version control systems name theirs.

§

Protect

Protects the library’s keys, or its secrets, anew.

The keys go to the platform’s keystore, or with –passphrase, under a new passphrase; with –secrets, the library’s secrets do instead, after their passphrase. The library’s passphrase and its secrets’ are never the same.

Fields

§passphrase: bool

A new passphrase, asked for twice, instead of the platform’s keystore.

§secrets: bool

Protects the library’s secrets, not its keys.

§

Secret

Works with secret values, such as passwords, and secret files.

No other command shows or takes secret values. Each asks for the passphrase of the library’s secrets, which is not the library’s, and forgets the secrets when it ends; nib secret generate needs no library.

Fields

§command: SecretCommand

What to do with secret values.

§

Policy

Works with storage policies: how many copies files need, and where.

A policy says how many copies the files of the personal space need, and whether this device keeps them in NibKeep’s store or where they are. Rules choose a file’s policy in order, unless the file has a policy of its own. The first command gives the space the default policies, Critical, Standard and Replaceable.

Fields

§command: PolicyCommand

What to do with policies.

§

Space

Works with spaces, the parts of the library shared as a whole.

Each space holds its own entities, and is shared, or not, as a whole. Your personal space is never shared.

Fields

§command: SpaceCommand

What to do with spaces.

§

Device

Works with your devices, which sync over the home network.

Each device holds copies of the library, which sync with each other.

Fields

§command: DeviceCommand

What to do with devices.

§

Backup

Works with your backups on drives and network shares.

A backup is a folder on a USB drive, a drive kept away from home, or a network share, which your computers keep up to date whenever they find it, such as when the drive is plugged in. It holds the library’s data encrypted, and no keys: whoever finds it reads nothing, and you restore from it on a device of yours.

Fields

§command: BackupCommand

What to do with backups.

§

Recovery

Works with recovery codes, and brings a library back.

A recovery code is on paper, and brings the library back when every device is lost, from a backup, or when this computer’s library no longer unlocks. It holds keys and no data. Whoever has the code and a backup reads everything, so keep it as safely as a passport.

Fields

§command: RecoveryCommand

What to do with recovery codes.

§

Purges

Lists the purges that wait here, and stops one or ends its wait.

A purge waits on this device, and on your backups plugged in here, before what it destroyed goes for good. An archive node keeps it apart, unreadable to everyone, for a while after it learns of a purge, 30 days unless marked otherwise (nib device mark –waits), so that no mistake or infected device wipes data everywhere at once. Meanwhile, a purge can be stopped here, which brings back everywhere what it destroyed, or its wait ended sooner.

Fields

§command: Option<PurgesCommand>

What to do with a purge that waits.

§

Sync

Syncs the library with your other devices on the home network.

Each gets what the other has, files too. Where a program syncs this device for all, as nib sync –serve or an app that has the library open does, it asks that one to sync now, and says what happened. As nib push, it sends your commits, as Git’s push does.

Fields

§serve: bool

Syncs this device for every program here, until stopped: answers your other devices, and syncs with them as changes come and they appear on the network. Where another program does that already, it waits, and takes over when that one ends.

§wait: u64

How long to look for your other devices on the network, in seconds; where a program syncs this device, how much longer than two minutes to wait for it.

§at_login: Option<Switch>

Syncs this library whenever you are logged in to this computer, with no app open, or stops: nibkeep-sync, installed beside nib, does it for every library turned on. It needs the library’s keys in the keystore, as nobody is there to type a passphrase.

§port: u16

With –serve, the UDP port to take connections on, for a firewall to let through: the first free of the ten from it, then any; any with 0. Without –serve, nib sync only makes connections.

§

Pull

Syncs with your other devices, then updates the copy of the tree.

It syncs as nib sync does, then brings the copy of the tree here to the tree as they left it, as nib update does: what Git’s pull does. The copy is brought up to date even if the sync fails, which it says after.

Fields

§wait: u64

How long to look for your other devices on the network, in seconds.

§partial: bool

Writes what parts have arrived of a commit whose other parts have not.

§clone: bool

Clones the Git repositories added elsewhere without asking.

§no_clone: bool

Clones no Git repository, and lists those it would.

§

Mcp

Serves nib to AI clients, and lets them work on your library.

An AI client runs nib mcp serve, on your library where nib mcp enable allowed AI agents, or on an AI agent’s copy of the library, which nib device pair –ai-agent adds.

Fields

§action: McpAction

What to do.

§

Absent(Absent)

The commands of other version control systems that nib does not have.

Trait Implementations§

Source§

impl Debug for Command

Source§

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

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

impl FromArgMatches for Command

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 Subcommand for Command

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
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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