Skip to main content

Crate nb_api

Crate nb_api 

Source
Expand description

Typed Rust interface to the nb note-taking CLI.

Handles notebook qualification, escaping, and output parsing. Wraps the nb CLI as a subprocess, providing async methods for all note-taking operations.

Structs§

Config
Configuration for constructing an NbClient.
NbClient
Client for invoking nb commands.

Enums§

EditMode
Behavior mode for nb edit content updates.
NbError
Errors from nb CLI invocation.
SearchMode
Matching mode for nb search query terms.
TaskStatus
Status filter for nb tasks.

Functions§

derive_git_notebook_name
Derive the notebook name from the current Git repository.
git_rev_parse
Run git rev-parse with the given arguments and return the output as a path.
leaked_git_names
Returns the names of every environment variable in the current process whose name starts with GIT_. Exposed so other call sites (a future std::process::Command variant in git_env, or any caller that wants the list without the scrub) share one enumeration policy.
scrub_git_env
Removes every environment variable whose name starts with GIT_ from the given tokio Command’s environment. The spawned process inherits every other variable from the parent (PATH, HOME, LANG, …), just not the ones that redirect Git’s view of the repository.
scrub_git_env_std
Synchronous-Command variant of scrub_git_env. nb-api uses tokio::process::Command for every nb invocation, but git_rev_parse (the only direct git spawn) uses std::process::Command. Both spawn sites must be scrubbed; if a future helper spawns git synchronously, use this overload.