### Run Abscissa Application Subcommand Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md Run a subcommand of a newly generated Abscissa application. This example invokes the 'start' subcommand. ```text cargo run -- start world ``` -------------------------------- ### Install Abscissa CLI Source: https://github.com/iqlusioninc/abscissa/blob/main/core/README.md Installs the Abscissa command-line utility for generating new applications. ```text $ cargo install abscissa ``` -------------------------------- ### Run Abscissa Application Subcommand Source: https://github.com/iqlusioninc/abscissa/blob/main/core/README.md Executes a subcommand of a generated Abscissa application. The example shows running the 'start' subcommand with an argument. ```text $ cargo run -- start world ``` -------------------------------- ### Install Abscissa CLI Utility Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md Install the Abscissa CLI utility using cargo to generate new applications. ```text cargo install abscissa ``` -------------------------------- ### Install Abscissa v0.6.0 locally Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Install the specified version of Abscissa on your local machine using `cargo install`. ```bash cargo install abscissa --version 0.6.0 ``` -------------------------------- ### Create New Abscissa Application Source: https://github.com/iqlusioninc/abscissa/blob/main/core/README.md Generates a new Abscissa application skeleton. This involves installing the CLI and then using it to create a new project. ```text $ cargo install abscissa $ abscissa new my_cool_app ``` -------------------------------- ### Define Command struct with clap v3 Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Use rustdoc comments for help messages and `#[derive(Parser)]` for command-line argument parsing. This example shows how to define a command with arguments and flags. ```rust use clap::Parser; /// Command help message #[derive(Command, Debug, Default, Parser)] pub struct Command { // This is a free command #[clap()] pub args: Vec, // This accepts short and long flags #[clap(short, long)] pub overwrite: bool, } ``` -------------------------------- ### Generate New Abscissa Application Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md Generate a new Abscissa application skeleton using the installed CLI utility. The generated app is a Cargo project. ```text cargo install abscissa abscissa new my_cool_app ``` -------------------------------- ### Define Application EntryPoint with clap v3 Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Create an entry point for your application using `#[derive(Command, Debug, Clap)]`. This struct allows for subcommands and defines application-level flags like verbose logging and config file path. ```rust /// Entry point for the application. It needs to be a struct to allow using subcommands! #[derive(Command, Debug, Clap)] #[clap(author, about, version)] pub struct EntryPoint { #[clap(subcommand)] // Replace this with you app name cmd: AppCmd, /// Enable verbose logging #[clap(short, long)] pub verbose: bool, /// Use the specified config file #[clap(short, long)] pub config: Option, } impl Runnable for EntryPoint { fn run(&self) { self.cmd.run() } } ``` -------------------------------- ### Print Basic Help Information Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md Display basic help information for an Abscissa application by running it with the --help flag. ```text cargo run -- --help ``` -------------------------------- ### Run Abscissa Tests Automatically Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md To automatically test framework changes, run this command. It generates an application and runs tests, rustfmt, and clippy. ```text $ cargo test ``` -------------------------------- ### Display Abscissa Application Help Source: https://github.com/iqlusioninc/abscissa/blob/main/core/README.md Prints basic help information for an Abscissa application. This is useful for understanding available commands and options. ```text $ cargo run -- --help ``` -------------------------------- ### Test Generated Abscissa Application Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md After generating an application, navigate to its directory and run tests, rustfmt, and clippy to ensure everything is working correctly. These checks are part of the CI process. ```text $ cd /tmp/example_app # or 'pushd /tmp/example_app' and 'popd' to return ``` ```text $ cargo test ``` ```text $ cargo fmt -- --check # generated app is expected to pass rustfmt ``` ```text $ cargo clippy ``` -------------------------------- ### Update application.rs imports and type aliases Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Modify `application.rs` to import `EntryPoint` instead of `AppCmd` and update the `Cmd` type alias accordingly. This ensures the application uses the new clap v3 entry point. ```rust // Remove this use crate::{commands::AppCmd, config::GorcConfig}; // Replace with this use crate::{commands::EntryPoint, config::GorcConfig}; // Remove this type Cmd = AppCmd; // Replace with this type Cmd = EntryPoint; // Remove this fn tracing_config(&self, command: &AppCmd) -> trace::Config { // Replace with this fn tracing_config(&self, command: &EntryPoint) -> trace::Config { ``` -------------------------------- ### Update From Implementation (Pre-Context) Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md This is the previous `From` implementation for converting `abscissa_core::Error` into the application's `Error` wrapper type. It is replaced by an implementation that accepts `Context`. ```rust impl From> for Error { fn from(other: abscissa_core::Error) -> Self { Error(other) } } ``` -------------------------------- ### Add abscissa_core dependency Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Update your `cargo.toml` to include the `v0.6.0` version of `abscissa_core` for both regular and development dependencies. ```toml [dependencies] abscissa_core = "0.6.0" [dev-dependencies] abscissa_core = "0.6.0" ``` -------------------------------- ### Update Configurable trait implementation Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Replace the `AppCmd` type with `EntryPoint` when implementing the `Configurable` trait for your application's command structure. ```rust impl Configurable for EntryPoint ``` -------------------------------- ### Update prelude.rs for core prelude and accessors Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Update the prelude.rs file to re-export abscissa_core::prelude and application state accessors. This ensures consistent access to core Abscissa functionalities. ```rust /// Abscissa core prelude pub use abscissa_core::prelude::*; /// Application state accessors pub use crate::application::{app_config, app_reader, app_writer}; ``` -------------------------------- ### Generate Abscissa Test Application Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md Manually generate a new Abscissa application that references your local copy of Abscissa. This is useful for debugging test failures. ```text $ cargo run -- new /tmp/example_app --patch-crates-io='abscissa = { path = "$PWD" }' ``` -------------------------------- ### Update version argument to flag in tests Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md In your `tests/acceptance.rs` file, change the way the version argument is passed from `runner.arg("version")` to `runner.arg("--version")` to align with clap v3's flag handling. ```rust // Remove this let mut cmd = runner.arg("version").capture_stdout().run(); // Replace with this let mut cmd = runner.arg("--version").capture_stdout().run(); ``` -------------------------------- ### Replace log with tracing in application.rs Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Update the logging_config function to use tracing_config when migrating from the 'log' crate to the 'tracing' crate. This involves changing function signatures and import paths. ```rust impl Application { // ... /// Get logging configuration from command-line options fn logging_config(&self, command: &MyCommand) -> logging::Config { if command.verbose() { logging::Config::verbose() } else { logging::Config::default() } } } ``` ```rust use abscissa_core::trace; impl Application { // ... /// Get tracing configuration from command-line options fn tracing_config(&self, command: &EntryPoint) -> trace::Config { if command.verbose { trace::Config::verbose() } else { trace::Config::default() } } } ``` -------------------------------- ### Abscissa Status Macros Source: https://github.com/iqlusioninc/abscissa/blob/main/README.md Demonstrates the usage of Abscissa's status macros for printing formatted output to STDOUT and STDERR. These macros provide Cargo-like status messages. ```rust // Print a Cargo-like justified status to STDOUT status_ok!("Loaded", "app loaded successfully"); // Print an error message status_err!("something bad happened"); // Print an indented attribute to STDOUT status_attr_ok!("good", "yep"); // Print an error attribute to STDERR status_attr_err!("error", "yep"); ``` -------------------------------- ### Abscissa Status Macros Source: https://github.com/iqlusioninc/abscissa/blob/main/core/README.md Demonstrates the usage of Abscissa's status macros for providing user feedback in the terminal. These macros offer different levels of verbosity and styling. ```rust // Print a Cargo-like justified status to STDOUT status_ok!("Loaded", "app loaded successfully"); // Print an error message status_err!("something bad happened"); // Print an indented attribute to STDOUT status_attr_ok!("good", "yep"); // Print an error attribute to STDERR status_attr_err!("error", "yep"); ``` -------------------------------- ### Replace gumdrop with clap v3 dependency Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md In your `Cargo.toml`, replace the `gumdrop` dependency with `clap` v3. ```toml clap = "3" ``` -------------------------------- ### Implement Context Method for ErrorKind in Rust Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Add a `context` method to your application's `ErrorKind` enum to capture error sources, similar to the functionality provided by the `failure` crate. This allows for creating an error context with an underlying source. ```rust use abscissa_core::error::BoxError; impl ErrorKind { /// Create an error context from this error pub fn context(self, source: impl Into) -> Context { Context::new(self, Some(source.into())) } } ``` -------------------------------- ### Abscissa Status Macros Source: https://github.com/iqlusioninc/abscissa/blob/main/cli/README.md Provides macros for displaying status messages in a Cargo-like format. ```rust status_ok!("Loaded", "app loaded successfully"); ``` ```rust status_err!("something bad happened"); ``` ```rust status_attr_ok!("good", "yep"); ``` ```rust status_attr_err!("error", "yep"); ``` -------------------------------- ### Replace lazy_static with AppCell for APPLICATION Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Replace the lazy_static! directive with AppCell for defining the APPLICATION constant. This change is necessary when migrating from lazy_static to once_cell. ```rust lazy_static! { /// Application state pub static ref APPLICATION: application::Lock = application::Lock::default(); } ``` ```rust use abscissa_core::application::AppCell; /// Application state pub static APPLICATION: AppCell = AppCell::new(); ``` -------------------------------- ### Commit Message for AUTHORS.md Update Source: https://github.com/iqlusioninc/abscissa/blob/main/CONTRIBUTING.md Use this commit message when adding yourself to the AUTHORS.md file. Ensure you replace placeholders with your GitHub username and legal name, and confirm your agreement to license contributions under Apache 2.0. ```text AUTHORS.md: adding [MY GITHUB USERNAME] and licensing my contributions I, [LEGAL NAME HERE], hereby agree to license all contributions I make to this project under the terms of the Apache License, Version 2.0. ``` -------------------------------- ### Replace lazy_static with Lazy for RUNNER Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Update the RUNNER definition in acceptance tests by replacing lazy_static! with once_cell::sync::Lazy. Ensure once_cell is added to dev-dependencies in Cargo.toml. ```rust lazy_static! { pub static ref RUNNER: CmdRunner = CmdRunner::default(); } ``` ```rust use once_cell::sync::Lazy; pub static RUNNER: Lazy = Lazy::new(|| CmdRunner::default()); ``` -------------------------------- ### Update Deref Implementation (Pre-Context) Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md This is the previous `Deref` implementation for the application's `Error` type, which dereferenced to `abscissa_core::Error`. It has been updated to dereference to `Context`. ```rust impl Deref for Error { type Target = abscissa_core::Error; fn deref(&self) -> &abscissa_core::Error { &self.0 } } ``` -------------------------------- ### Update Error Conversion in Rust Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Change the `From` implementation for the application's `Error` type to accept `abscissa_core::error::Context` instead of `abscissa_core::Error`. This aligns with the updated error handling strategy. ```rust use abscissa_core::error::Context; impl From> for Error { fn from(context: Context) -> Self { Error(Box::new(context)) } } ``` -------------------------------- ### Update Error Type Definition (Pre-Context) Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md This is the previous definition of the `Error` type before the removal of the `failure` crate and the adoption of `abscissa_core::error::Context`. It directly wraps `abscissa_core::Error`. ```rust /// Error type #[derive(Debug)] pub struct Error(abscissa_core::Error); ``` -------------------------------- ### Implement std::error::Error for App Error Type in Rust Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Add a `std::error::Error` implementation for your application's `Error` type. This allows your custom error type to be used seamlessly with Rust's standard error handling mechanisms, including providing access to the error source. ```rust impl std::error::Error for Error { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { self.0.source() } } ``` -------------------------------- ### Remove Config derive from MyConfig Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Remove the custom derive for `Config` from the `MyConfig` struct when migrating to a blanket implementation. This simplifies the struct definition. ```rust use abscissa_core::{Config, EntryPoint}; /// MyApp Configuration #[derive(Clone, Config, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct MyConfig { // ... } ``` ```rust /// MyApp Configuration #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct MyConfig { // ... } ``` -------------------------------- ### Update Deref Implementation for Error in Rust Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Modify the `Deref` implementation for the application's `Error` type to point to `Context` instead of `abscissa_core::Error`. This reflects the change in the underlying error structure. ```rust impl Deref for Error { type Target = Context; fn deref(&self) -> &Context { &self.0 } } ``` -------------------------------- ### Update Error Type Definition in Rust Source: https://github.com/iqlusioninc/abscissa/blob/main/CHANGELOG.md Modify the application's Error type definition to use `abscissa_core::error::Context` instead of the deprecated `abscissa_core::Error`. This change is necessary after removing the `failure` crate. ```rust use abscissa_core::error::Context; /// Error type #[derive(Debug)] pub struct Error(Box>); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.