nautilus_cli/lib.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2025 Posei Systems Pty Ltd. All rights reserved.
3// https://poseitrader.io
4//
5// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6// You may not use this file except in compliance with the License.
7// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Command-line interface and tools for [PoseiTrader](http://poseitrader.io).
17//!
18//! The *cli* crate provides a comprehensive command-line interface for managing and
19//! operating PoseiTrader installations. It includes tools for database management,
20//! system configuration, and operational utilities:
21//!
22//! - Database initialization and management commands.
23//! - PostgreSQL schema setup and maintenance.
24//! - Configuration validation and setup utilities.
25//! - System administration and operational tools.
26//!
27//! # Platform
28//!
29//! [PoseiTrader](http://poseitrader.io) is an open-source, high-performance, production-grade
30//! algorithmic trading platform, providing quantitative traders with the ability to backtest
31//! portfolios of automated trading strategies on historical data with an event-driven engine,
32//! and also deploy those same strategies live, with no code changes.
33//!
34//! PoseiTrader's design, architecture, and implementation philosophy prioritizes software correctness and safety at the
35//! highest level, with the aim of supporting mission-critical, trading system backtesting and live deployment workloads.
36
37#![warn(rustc::all)]
38#![deny(unsafe_code)]
39#![deny(nonstandard_style)]
40#![deny(missing_debug_implementations)]
41#![deny(clippy::missing_errors_doc)]
42#![deny(clippy::missing_panics_doc)]
43#![deny(rustdoc::broken_intra_doc_links)]
44
45mod database;
46pub mod opt;
47
48use crate::{
49 database::postgres::run_database_command,
50 opt::{Commands, PoseiCli},
51};
52
53/// Runs the Posei CLI based on the provided options.
54///
55/// # Errors
56///
57/// Returns an error if execution of the specified command fails.
58pub async fn run(opt: PoseiCli) -> anyhow::Result<()> {
59 match opt.command {
60 Commands::Database(database_opt) => run_database_command(database_opt).await?,
61 }
62 Ok(())
63}