diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5495e23..dd03a34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,8 +39,7 @@ jobs: tag_name: ${{ steps.version-check.outputs.ver }} token: ${{ secrets.PAT_TOKEN }} - # - name: Push to Cargo - # run: | - # cargo publish - # env: - # CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + - name: Push to Cargo + run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index 082ab04..0818c5d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "rxe" -version = "0.0.5" +version = "0.1.0" edition = "2021" license = "MIT" description = "Easily customizable command runner made with Rust 🦀" repository = "https://github.com/loxygenK/rxe" -keyword = ["runner", "task"] +keywords = ["runner", "task"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 88d4f75..5672ed3 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -1,7 +1,5 @@ pub(crate) mod exec; -use std::env; - pub struct Environment { pub config_file: Option, pub args: Vec diff --git a/src/command.rs b/src/command.rs index 302aba2..1e07bb9 100644 --- a/src/command.rs +++ b/src/command.rs @@ -10,7 +10,6 @@ use crate::helper::replace_iter::ReplaceIter; #[derive(Debug, PartialEq)] pub enum ParseStatus { NotParsed, - ExpectingNext, Parsed(ArgumentValue) } @@ -59,7 +58,7 @@ impl<'a> CommandParser<'a> { Ok(Self { cmd, arg }) } - fn parse(mut self) -> Result { + fn parse(self) -> Result { let mut args_status = self.cmd.args.iter() .map(|x| (x.name.clone(), ParseStatus::NotParsed)) .collect::>(); diff --git a/src/config.rs b/src/config.rs index d50af34..3d2b6cc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,10 +1,9 @@ use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::fs; -use std::io::{self, ErrorKind, Read}; +use std::io::{self, ErrorKind}; use serde::{Serialize, Deserialize}; -use crate::command::ParseStatus::Parsed; use crate::domain::{Constraints, Command, Argument, Config}; diff --git a/src/domain/argument_value.rs b/src/domain/argument_value.rs index 56ce9a2..fc76238 100644 --- a/src/domain/argument_value.rs +++ b/src/domain/argument_value.rs @@ -3,5 +3,4 @@ pub enum ArgumentValue { Text(String), Flag(bool), Number(f64), - Choice(String) } diff --git a/src/placeholder/fill.rs b/src/placeholder/fill.rs index e898007..b47b3d9 100644 --- a/src/placeholder/fill.rs +++ b/src/placeholder/fill.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::ops::Range; -use crate::{domain::ArgumentValue, constraints::{text::TextConstraint, Constraint, number::NumberConstraint, flag::FlagConstraint, choice::ChoiceConstraint}}; +use crate::{domain::ArgumentValue, constraints::{text::TextConstraint, Constraint, number::NumberConstraint, flag::FlagConstraint}}; use super::{Placeholder, PlaceholderParseError}; @@ -10,10 +10,9 @@ pub(super) fn fill_first_placeholder(original: &str, values: &HashMap TextConstraint.fill_placeholder(value, &placeholder.args), - ArgumentValue::Number(t) => NumberConstraint.fill_placeholder(value, &placeholder.args), - ArgumentValue::Flag(t) => FlagConstraint.fill_placeholder(value, &placeholder.args), - ArgumentValue::Choice(t) => TextConstraint.fill_placeholder(value, &placeholder.args), + ArgumentValue::Text(_) => TextConstraint.fill_placeholder(value, &placeholder.args), + ArgumentValue::Number(_) => NumberConstraint.fill_placeholder(value, &placeholder.args), + ArgumentValue::Flag(_) => FlagConstraint.fill_placeholder(value, &placeholder.args), }?; let mut bytes = original @@ -35,7 +34,7 @@ pub(super) fn fill_first_placeholder(original: &str, values: &HashMap>) { let value_map = map!("fill".to_string() => value); - let blanket_start = (placeholder.find('_').unwrap()); + let blanket_start = placeholder.find('_').unwrap(); let filled = fill_first_placeholder(placeholder, &value_map, &Placeholder { range: blanket_start..(blanket_start + 4), @@ -63,6 +62,6 @@ mod tests { prefix: "".to_string(), args: placeholder_arg.unwrap_or_default().iter().map(|(k, v)| (k.to_string(), v.to_string())).collect() }); - assert_eq!(filled.map(|(s, r)| s), Ok(expected.to_string())) + assert_eq!(filled.map(|(s, _)| s), Ok(expected.to_string())) } } diff --git a/src/placeholder/parse.rs b/src/placeholder/parse.rs index f0199b8..eb882f7 100644 --- a/src/placeholder/parse.rs +++ b/src/placeholder/parse.rs @@ -3,7 +3,6 @@ use std::{collections::HashMap, convert::TryInto}; use once_cell::sync::Lazy; use regex::Regex; -use crate::domain::ArgumentValue; use crate::helper::range_shift::RangeShift; use super::{Placeholder, PlaceholderParseError}; diff --git a/src/runner/tmpfile.rs b/src/runner/tmpfile.rs index 3a92dbb..1d89cd2 100644 --- a/src/runner/tmpfile.rs +++ b/src/runner/tmpfile.rs @@ -1,4 +1,4 @@ -use std::{fs::File, io::{Error, Write}, env, path::MAIN_SEPARATOR}; +use std::{fs::File, io::Write, env, path::MAIN_SEPARATOR}; use crate::util::get_random_string;