Skip to main content

Command

Enum Command 

Source
pub enum Command {
Show 29 variants Init { wizard: bool, yes: bool, }, Completions { shell: CompletionShell, }, Import { file: Option<PathBuf>, }, Add { cmd: String, cwd: Option<String>, exit_code: i64, }, Search {
Show 14 fields query: Option<String>, query_opt: Option<String>, print: bool, limit: usize, project: Option<String>, branch: Option<String>, exit_code: Option<i64>, failed: bool, since: Option<String>, before: Option<String>, cwd: Option<String>, shell: Option<String>, json: bool, id_only: bool,
}, Tui { query: Option<String>, project: Option<String>, branch: Option<String>, cwd: Option<String>, failed: bool, }, Bashrc, Shell { action: ShellCommand, }, Migrate, Stats { project: Option<String>, branch: Option<String>, since: Option<String>, json: bool, }, Doctor { fix: bool, json: bool, }, Config { action: ConfigCommand, }, Backup { output: Option<PathBuf>, json: bool, }, Restore { archive: PathBuf, dry_run: bool, yes: bool, }, Export { format: ExportFormat, project: Option<String>, branch: Option<String>, output: Option<PathBuf>, gzip: bool, }, List { limit: Option<usize>, project: Option<String>, branch: Option<String>, json: bool, }, Show { id: i64, }, Print { id: i64, }, Delete { id: i64, dry_run: bool, yes: bool, }, Prune { older_than: String, project: Option<String>, branch: Option<String>, dry_run: bool, yes: bool, }, Version, Update { json: bool, upgrade: bool, yes: bool, require_signature: bool, }, Upgrade { dry_run: bool, yes: bool, version: Option<String>, target: Option<String>, require_signature: bool, }, Uninstall { dry_run: bool, yes: bool, purge: bool, }, Project { action: ProjectCommand, }, Maintenance { action: MaintenanceCommand, }, Session { action: SessionCommand, }, Secrets { action: SecretsCommand, }, Runbook { last: bool, session: Option<String>, project: Option<String>, output: Option<PathBuf>, force: bool, limit: Option<u32>, title: Option<String>, format: RunbookFormat, no_redact: bool, group_by: GroupBy, },
}

Variants§

§

Init

Initialise la configuration et la base de données.

Fields

§wizard: bool

Lance l’assistant d’onboarding interactif (intégration Bash, import, diagnostic). Toutes les actions proposées sont non destructives.

§yes: bool

En mode --wizard non interactif, accepte les choix sûrs par défaut sans rien supprimer ni purger.

§

Completions

Génère un script de complétion shell sur stdout (bash, zsh, fish).

mnemo n’écrit jamais dans vos fichiers shell : redirigez la sortie vers l’emplacement adéquat (voir docs/UX_ONBOARDING.md).

Fields

§shell: CompletionShell

Shell cible.

§

Import

Importe l’historique Bash (~/.bash_history par défaut) dans la base.

Fields

§file: Option<PathBuf>

Fichier d’historique à importer.

§

Add

Ajoute une commande dans la base.

Fields

§cmd: String

Commande à enregistrer.

§cwd: Option<String>

Répertoire de travail (défaut : répertoire courant).

§exit_code: i64

Code de sortie de la commande.

§

Search

Ouvre l’interface TUI interactive de recherche.

Fields

§query: Option<String>

Requête initiale (positionnelle, optionnelle).

§query_opt: Option<String>

Requête explicite (équivalent à l’argument positionnel).

§print: bool

Mode non interactif : imprime les résultats sur stdout sans TUI.

§limit: usize

Nombre maximal de résultats affichés en mode –print.

§project: Option<String>

Filtre sur un projet Git (nom du dossier racine ou chemin git_root).

§branch: Option<String>

Filtre sur une branche Git.

§exit_code: Option<i64>

Filtre sur un code de sortie exact (ex : 0, 1, 127).

§failed: bool

N’affiche que les commandes en échec (exit_code ≠ 0).

§since: Option<String>

Limite l’âge des résultats (durée 24h/7d/2w/3m/1y ou date AAAA-MM-JJ).

§before: Option<String>

N’affiche que les commandes antérieures à une date (AAAA-MM-JJ). Alias : --until.

§cwd: Option<String>

Filtre sur un répertoire de travail exact.

§shell: Option<String>

Filtre sur un shell exact (ex : bash, zsh).

§json: bool

Produit une sortie JSON stable (implique le mode non interactif).

§id_only: bool

N’affiche que les identifiants, un par ligne (implique le mode non interactif). Pratique pour chaîner avec mnemo show/mnemo print.

§

Tui

Ouvre la TUI avancée (interface interactive principale).

Fields

§query: Option<String>

Requête initiale (positionnelle, optionnelle).

§project: Option<String>

Filtre initial sur un projet Git (nom du dossier racine).

§branch: Option<String>

Filtre initial sur une branche Git.

§cwd: Option<String>

Filtre initial sur un répertoire de travail.

§failed: bool

N’affiche que les commandes en échec (exit_code ≠ 0).

§

Bashrc

Affiche le snippet d’intégration Bash à ajouter dans ~/.bashrc.

§

Shell

Gère l’intégration shell installée dans ~/.bashrc.

Fields

§

Migrate

Applique les migrations de schéma SQLite en attente.

§

Stats

Affiche des statistiques d’usage (texte simple).

Fields

§project: Option<String>

Filtre sur un projet Git (nom du dossier racine, chemin git_root, ou current).

§branch: Option<String>

Filtre sur une branche Git.

§since: Option<String>

Limite la fenêtre d’analyse (durée 24h/7d/2w/3m/1y ou date AAAA-MM-JJ).

§json: bool

Produit une sortie JSON exploitable.

§

Doctor

Diagnostique l’installation locale de mnemo.

Fields

§fix: bool

Répare les éléments manquants (config, base, bloc .bashrc).

§json: bool

Produit une sortie JSON exploitable.

§

Config

Gère la configuration locale de mnemo.

Fields

§

Backup

Crée une sauvegarde locale complète (archive .tar.gz).

Fields

§output: Option<PathBuf>

Dossier de destination (défaut : ~/.local/share/mnemo/backups/).

§json: bool

Produit une sortie JSON exploitable.

§

Restore

Restaure une sauvegarde (.tar.gz) après vérification.

Fields

§archive: PathBuf

Chemin de l’archive de sauvegarde.

§dry_run: bool

Montre ce qui serait fait sans rien modifier.

§yes: bool

Confirme la restauration sans question interactive.

§

Export

Exporte les commandes en JSON ou CSV.

Fields

§format: ExportFormat

Format de sortie.

§project: Option<String>

Filtre sur un projet Git (nom du dossier racine ou chemin git_root).

§branch: Option<String>

Filtre sur une branche Git.

§output: Option<PathBuf>

Fichier de sortie (défaut : stdout).

§gzip: bool

Compresse la sortie en gzip (.json.gz / .csv.gz).

§

List

Affiche les dernières commandes avec leurs IDs.

Fields

§limit: Option<usize>

Nombre de commandes affichées (défaut : 20).

§project: Option<String>

Filtre sur un projet Git (nom du dossier racine ou chemin git_root).

§branch: Option<String>

Filtre sur une branche Git.

§json: bool

Produit une sortie JSON exploitable.

§

Show

Affiche le détail complet d’une commande par son ID, sans l’exécuter.

mnemo n’exécute jamais une commande de l’historique : show se contente de lire la base. Si la commande a déjà été redactée, sa forme redactée stockée est affichée telle quelle.

Fields

§id: i64

Identifiant de la commande (voir mnemo list ou mnemo search).

§

Print

Imprime uniquement la commande brute sur stdout, sans décor ni exécution.

Aucun label, aucune couleur : la sortie peut être copiée ou redirigée. mnemo n’exécute jamais la commande ; l’utilisateur reste responsable de ce qu’il fait de la sortie.

Fields

§id: i64

Identifiant de la commande (voir mnemo list ou mnemo search).

§

Delete

Supprime une commande par son ID (après confirmation).

Fields

§id: i64

Identifiant de la commande à supprimer.

§dry_run: bool

Montre la commande ciblée sans la supprimer.

§yes: bool

Confirme la suppression sans question interactive.

§

Prune

Nettoie les commandes plus anciennes qu’une durée donnée.

Fields

§older_than: String

Durée d’ancienneté (ex : 30d, 12w, 6m, 1y).

§project: Option<String>

Filtre sur un projet Git (nom du dossier racine ou chemin git_root).

§branch: Option<String>

Filtre sur une branche Git.

§dry_run: bool

Montre ce qui serait supprimé sans rien modifier.

§yes: bool

Confirme le nettoyage sans question interactive.

§

Version

Affiche des informations détaillées de version et de build.

§

Update

Vérifie si une nouvelle version est disponible (sans rien installer).

En terminal interactif, si une mise à jour existe, propose de lancer mnemo upgrade immédiatement (réponse par défaut : non). En mode non interactif (CI, script, cron, pipe), reste une simple vérification. --upgrade enchaîne directement l’installation quand une mise à jour est disponible ; combiné à --yes, il permet un upgrade automatisé. --require-signature rend la vérification Sigstore (cosign) obligatoire lors de l’upgrade enchaîné.

Fields

§json: bool

Sortie au format JSON (vérification seule, sans proposition).

§upgrade: bool

Si une mise à jour est disponible, lance directement mnemo upgrade.

§yes: bool

Avec --upgrade, installe sans confirmation interactive.

§require_signature: bool

Avec --upgrade, exige une signature Sigstore valide (cosign).

§

Upgrade

Télécharge et installe la dernière version stable (remplace le binaire).

Fields

§dry_run: bool

Montre ce qui serait fait sans rien télécharger ni remplacer.

§yes: bool

Confirme l’installation sans question interactive.

§version: Option<String>

Force une version précise (ex : v0.5.0) au lieu de la dernière.

§target: Option<String>

Force un triplet cible (ex : aarch64-unknown-linux-musl).

§require_signature: bool

Exige une signature Sigstore valide (cosign requis) avant d’installer.

§

Uninstall

Désinstalle mnemo : binaire + intégration shell. Conserve les données.

Fields

§dry_run: bool

Montre ce qui serait supprimé sans rien modifier.

§yes: bool

Confirme la désinstallation sans question interactive.

§purge: bool

Supprime AUSSI la configuration, la base et les sauvegardes.

§

Project

Inspecte le projet courant et les projets connus de l’historique.

Fields

§

Maintenance

Maintenance de l’historique (nettoyage automatique configurable).

Fields

§

Session

Navigue, consulte et exporte des sessions de travail.

Une session regroupe les commandes partageant un même session_id, capturé par l’intégration shell (MNEMO_SESSION_ID). Les commandes importées ou enregistrées sans cet identifiant ne sont pas rattachées à une session.

Fields

§

Secrets

Analyse et redacte les secrets présents dans l’historique déjà stocké.

scan repère les commandes potentiellement sensibles et les affiche toujours sous forme redactée. redact les nettoie en place (dry-run par défaut, sauvegarde obligatoire avant toute écriture). Aucun secret n’est jamais affiché en clair.

Fields

§

Runbook

Génère un runbook Markdown réutilisable à partir d’une session ou d’un projet Git.

Chaque commande est présentée dans une section Markdown numérotée avec son répertoire de travail, triée par ordre chronologique (le plus ancien en premier). Les commandes vides sont exclues. Le résultat peut être écrit sur stdout (défaut) ou dans un fichier (--output).

Exactement un des drapeaux --last, --session ou --project est requis. Si aucun n’est fourni, une erreur claire est affichée.

Fields

§last: bool

Cible la dernière session (incompatible avec --session et --project).

§session: Option<String>

Identifiant de session explicite (incompatible avec --last et --project).

§project: Option<String>

Nom court ou chemin git_root d’un projet (incompatible avec --last et --session).

§output: Option<PathBuf>

Fichier de sortie (défaut : stdout).

§force: bool

Autorise l’écrasement du fichier de sortie si déjà existant.

§limit: Option<u32>

Nombre maximal de commandes incluses dans le runbook.

§title: Option<String>

Titre personnalisé du runbook (défaut : identifiant de session ou nom de projet).

§format: RunbookFormat

Format de sortie. Par défaut, rendu Markdown. json produit un document JSON stable et déterministe.

§no_redact: bool

Désactive la redaction des secrets (activée par défaut). Sans ce flag, chaque commande est analysée et les valeurs sensibles détectées sont remplacées par [REDACTED] avant inclusion dans le runbook.

§group_by: GroupBy

Mode de groupement des commandes dans le runbook. none (défaut) : liste plate numérotée. cwd : sections par répertoire de travail. project : sections par racine Git.

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = 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.