Skip to content

Commit

Permalink
Simplified the commands parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-eth committed Apr 3, 2024
1 parent f3b5f4a commit e34faa6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT"
name = "soldeer"
readme = "./README.md"
repository = "https://github.com/mario-eth/soldeer"
version = "0.2.7"
version = "0.2.8"

[dependencies]
chrono = {version = "0.4.34", features = ["serde"]}
Expand Down Expand Up @@ -39,7 +39,7 @@ zip-extract = "0.1.3"
tokio-test = "0.4.3"

[lib]
name = "soldeer_lib"
name = "soldeer"
path = "src/lib.rs"

[[bin]]
Expand Down
1 change: 1 addition & 0 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub async fn login() -> Result<(), LoginError> {
.token;
let mut file: std::fs::File = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.append(false)
.open(&security_file)
Expand Down
5 changes: 1 addition & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ use std::path::{
PathBuf,
};
use std::process::exit;
use toml::{
self,
Table,
};
use toml::Table;
use yansi::Paint;
extern crate toml_edit;
use std::io;
Expand Down
9 changes: 3 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ mod utils;
mod versioning;

use crate::auth::login;
use crate::commands::{
Args,
Subcommands,
};
use crate::commands::Subcommands;
use crate::config::{
get_foundry_setup,
read_config,
Expand Down Expand Up @@ -48,8 +45,8 @@ pub struct FOUNDRY {
}

#[tokio::main]
pub async fn run(args: Args) -> Result<(), SoldeerError> {
match args.command {
pub async fn run(command: Subcommands) -> Result<(), SoldeerError> {
match command {
Subcommands::Install(install) => {
println!("{}", Paint::green("🦌 Running soldeer install 🦌\n"));
if !install.dependency.contains('~') {
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
extern crate soldeer_lib;
extern crate soldeer;
use yansi::Paint;

use crate::soldeer_lib::commands::Args;
use crate::soldeer::commands::Args;
use clap::Parser;

pub fn main() {
let args = Args::parse();
match soldeer_lib::run(args) {
match soldeer::run(args.command) {
Ok(_) => {}
Err(err) => {
eprintln!("{}", Paint::red(err.message))
Expand Down

0 comments on commit e34faa6

Please sign in to comment.