Skip to content

Commit

Permalink
chore: removes pkg metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
rvigo committed May 26, 2024
1 parent 6a72fd5 commit 01d37af
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 106 deletions.
10 changes: 2 additions & 8 deletions cl-cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@ use super::subcommands::{config::Config, exec::Exec, misc::Misc, share::Share};
use clap::{Parser, Subcommand as ClapSubcommand};

const PKG_NAME: &str = env!("CARGO_PKG_NAME");
const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");

#[derive(Parser)]
#[clap(
name = PKG_NAME,
about,
long_about = None,
version = PKG_VERSION,
propagate_version = false,
dont_collapse_args_in_usage = true,
args_conflicts_with_subcommands = true,
)]
pub struct App {
#[clap(subcommand)]
pub subcommands: Option<Subcommands>,
#[clap(
short,
long,
required = false,
action,
help = "Print version info and exit"
)]
pub version: bool,
}

impl App {
Expand Down
7 changes: 1 addition & 6 deletions cl-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use app::Subcommands;
use cl_core::{config::Config, resource::metadata::MAIN_PACKAGE_METADATA};
use cl_core::config::Config;
use subcommands::Subcommand;

pub mod app;
Expand All @@ -14,8 +14,3 @@ pub fn run_subcommands(subcommands: Subcommands, config: Config) -> Result<()> {
Subcommands::Config(subcommand_config) => subcommand_config.run(config),
}
}

pub fn print_metadata() -> Result<()> {
println!("{}", MAIN_PACKAGE_METADATA.to_string());
Ok(())
}
85 changes: 0 additions & 85 deletions cl-core/src/resource/metadata.rs

This file was deleted.

1 change: 0 additions & 1 deletion cl-core/src/resource/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod commands_file_handler;
pub mod errors;
pub mod fs_wrapper;
pub mod metadata;
pub mod toml;

/// Loads a `Commands` instance from a command file at the given path
Expand Down
3 changes: 1 addition & 2 deletions cl-gui/src/widgets/base_widget.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::StatusBarItem;
use crate::entities::terminal::TerminalSize;
use cl_core::resource::metadata::MAIN_PACKAGE_METADATA;
use tui::{
buffer::Buffer,
layout::{Alignment, Constraint, Direction, Layout, Rect},
Expand Down Expand Up @@ -36,7 +35,7 @@ where
let base_block = Block::default()
.borders(Borders::ALL)
.style(Style::default())
.title(format!(" {} ", MAIN_PACKAGE_METADATA.to_string()))
.title(env!("CARGO_PKG_VERSION"))
.title_alignment(Alignment::Right)
.border_type(BorderType::Plain);

Expand Down
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{Context, Result};
use cl_cli::{app::App, print_metadata, run_subcommands};
use cl_cli::{app::App, run_subcommands};
use cl_core::{
config::Config,
logger::{LoggerBuilder, LoggerType},
Expand All @@ -16,9 +16,7 @@ async fn main() -> Result<()> {

let app = App::parse_app();

if app.version {
print_metadata()
} else if let Some(subcommands) = app.subcommands {
if let Some(subcommands) = app.subcommands {
logger
.with_logger_type(LoggerType::Subcommand)
.build()
Expand Down

0 comments on commit 01d37af

Please sign in to comment.