Abscissa is a microframework for building Rust applications (either CLI tools or network/web services), aiming to provide a large number of features with a minimal number of dependencies, and with a strong focus on security.
terminal
and logging
.serde
-parsed
configuration types which can be dynamically updated at runtime.log
to provide application-level logging.secrets
module includes a Secret
type which derives serde's Deserialize
and can be used to represent secret
values parsed from configuration files or elsewhere (e.g. credentials loaded
from the environment or network requests)Abscissa presently consists of three crates:
cargo install abscissa
abscissa_core
Requires Rust 1.74 or newer.
To generate a new Abscissa application, install the abscissa
CLI utility:
$ cargo install abscissa
The following commands will generate an Abscissa application skeleton:
$ cargo install abscissa
$ abscissa new my_cool_app
The resulting app is a Cargo project. The following files are particularly noteworthy:
src/application.rs
: Abscissa application type for your appsrc/commands*
: application entrypoint and subcommands. Make sure to
check out the start.rs
example of how to make a subcommand.src/config.rs
: application configurationsrc/error.rs
: error typesAbscissa applications are implemented as Rust libraries, but have a
src/bin
subdirectory where the binary entrypoint lives. This means you
can run the following within your newly generated application:
$ cargo run -- start world
This will invoke the start
subcommand of your application (you
might want to rename that in your app) which will print the following:
Hello, world!
You can also run the following to print basic help information:
$ cargo run -- --help
// 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");
A1: The word "abscissa" is the key to the Kryptos K2 panel.
A2: Imagine you're A-B testing a couple of scissors... with attitude.
The main way to test framework changes is by generating an application with Abscissa's built-in application generator and running tests against the generated application (also rustfmt, clippy).
To generate a test application and test it automatically, you can simply do:
$ cargo test
However, when debugging test failures against a generated app, it's helpful to know how to drive the app generation and testing process manually. Below are instructions on how to do so.
If you've already run:
$ git clone https://github.com/iqlusioninc/abscissa/
...and are inside the abscissa
directory and want to test your changes,
you can generate an application by running the following command:
$ cargo run -- new /tmp/example_app --patch-crates-io='abscissa = { path = "$PWD" }'
This will generate a new Abscissa application in /tmp/example_app
which
references your local copy of Abscissa.
After that, change directory to the newly generated app and run the tests to ensure things are still working (the tests, along with rustfmt and clippy are run as part of the CI process):
$ cd /tmp/example_app # or 'pushd /tmp/example_app' and 'popd' to return
$ cargo test
$ cargo fmt -- --check # generated app is expected to pass rustfmt
$ cargo clippy
We abide by the Contributor Covenant and ask that you do as well.
For more information, please see CODE_OF_CONDUCT.md.
The abscissa crate is distributed under the terms of the Apache License (Version 2.0).
Copyright © 2018-2024 iqlusion
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
If you are interested in contributing to this repository, please make sure to read the CONTRIBUTING.md and CODE_OF_CONDUCT.md files first.