Skip to main content

Module args

Module args 

Source
Expand description

Command line argument parsing using clap. The args module defines the command-line argument structures and parsing logic for the bonds CLI application using the clap crate. It includes the main Cli struct, which represents the overall command-line interface, and the Commands enum, which defines the various subcommands that users can execute. Each subcommand may have its own set of arguments and options, allowing for a flexible and user-friendly command-line experience when managing directory bonds (symlinks with tracking).

Structs§

Cli
The Cli struct defines the command-line interface for the bonds CLI application. It uses the clap crate to parse command-line arguments and subcommands. The db field allows users to specify a custom path to the database file, while the command field represents the specific action that the user wants to perform, such as adding a new bond, listing existing bonds, or managing configuration. Each command is defined as a variant of the Commands enum, which further organizes related actions into subcommands for better usability and clarity.

Enums§

Commands
The Commands enum defines the various commands that the bonds CLI application supports. Each variant corresponds to a specific action that can be performed on the bonds, such as adding a new bond, listing existing bonds, updating bond information, and managing metadata. Some commands have their own subcommands for more granular actions, such as the Config and Metadata commands. This structure allows for a clear and organized command-line interface, making it easier for users to understand and use the available functionality of the CLI application.
ConfigAction
Subcommands for the config command, which allows users to get or set configuration values for the bonds CLI application. The Get variant retrieves the current value of a specified configuration key, while the Set variant updates a configuration key with a new value. This allows users to customize the behavior of the CLI application by modifying its configuration settings.
MetadataAction
Subcommands for the metadata command, which allows users to get, set, or remove metadata key-value pairs associated with a specific bond. The Get variant retrieves the value of a specified metadata key for a given bond, or all metadata if no key is provided. The Set variant updates or adds a metadata key-value pair for a specified bond. The Remove variant deletes a specific metadata key from a given bond. This functionality enables users to manage additional information about their bonds in a flexible way.