Skip to content

Commit

Permalink
refactor: small reorganisation of launchpad crate
Browse files Browse the repository at this point in the history
The crate is slightly reorganised to accommodate the addition of the launcher binary. It will be
useful to have the launcher and TUI tightly coupled, with the same version number.

The changes:
* Move `node-launchpad` into its own `bin` directory. Shortly the launcher will be added as a
  directory alongside it.
* Since the `Cli` struct was the only thing in the `cli` module, the module can be removed in favour
  of the struct sitting alongside the TUI binary's `main` module.
* Correct misspelled version keys in references.
* Tidy dependencies to be sorted alphabetically for easier reference.
  • Loading branch information
jacderida committed May 4, 2024
1 parent 920caec commit 4173de5
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 51 deletions.
8 changes: 4 additions & 4 deletions sn_node_launchpad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ build = "build.rs"

[[bin]]
name = "node-launchpad"
path = "src/main.rs"
path = "src/bin/tui/main.rs"

[dependencies]
sn_peers_acquisition = { verison = "0.2.10", path = "../sn_peers_acquisition" }
sn_service_management = { verison = "0.2.4", path = "../sn_service_management" }
better-panic = "0.3.0"
clap = { version = "4.4.5", features = [
"derive",
Expand All @@ -40,9 +38,11 @@ log = "0.4.20"
pretty_assertions = "1.4.0"
ratatui = { version = "0.26.0", features = ["serde", "macros"] }
serde = { version = "1.0.188", features = ["derive"] }
sn-node-manager = { verison = "0.7.4", path = "../sn_node_manager" }
serde_json = "1.0.107"
signal-hook = "0.3.17"
sn-node-manager = { version = "0.7.4", path = "../sn_node_manager" }
sn_peers_acquisition = { version = "0.2.10", path = "../sn_peers_acquisition" }
sn_service_management = { version = "0.2.4", path = "../sn_service_management" }
strip-ansi-escapes = "0.2.0"
strum = { version = "0.26.1", features = ["derive"] }
tokio = { version = "1.32.0", features = ["full"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,37 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

pub mod action;
pub mod app;
pub mod cli;
pub mod components;
pub mod config;
pub mod mode;
pub mod tui;
pub mod utils;

#[macro_use]
extern crate tracing;

use clap::Parser;
use cli::Cli;
use color_eyre::eyre::Result;
use tokio::task::LocalSet;

use crate::{
use sn_node_launchpad::{
app::App,
utils::{initialize_logging, initialize_panic_handler},
utils::{initialize_logging, initialize_panic_handler, version},
};

#[derive(Parser, Debug)]
#[command(author, version = version(), about)]
pub struct Cli {
#[arg(
short,
long,
value_name = "FLOAT",
help = "Tick rate, i.e. number of ticks per second",
default_value_t = 1.0
)]
pub tick_rate: f64,

#[arg(
short,
long,
value_name = "FLOAT",
help = "Frame rate, i.e. number of frames per second",
default_value_t = 60.0
)]
pub frame_rate: f64,
}

async fn tokio_main() -> Result<()> {
initialize_logging()?;

Expand Down
32 changes: 0 additions & 32 deletions sn_node_launchpad/src/cli.rs

This file was deleted.

18 changes: 18 additions & 0 deletions sn_node_launchpad/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2024 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

pub mod action;
pub mod app;
pub mod components;
pub mod config;
pub mod mode;
pub mod tui;
pub mod utils;

#[macro_use]
extern crate tracing;

0 comments on commit 4173de5

Please sign in to comment.