Skip to content

Commit

Permalink
Merge pull request #26 from ink0rr/dev
Browse files Browse the repository at this point in the history
rgl v0.11.0
  • Loading branch information
ink0rr authored Aug 19, 2024
2 parents 5a34a4f + 98d16f2 commit 8d25448
Show file tree
Hide file tree
Showing 14 changed files with 221 additions and 64 deletions.
108 changes: 77 additions & 31 deletions Cargo.lock

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

19 changes: 10 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
[package]
name = "rgl"
version = "0.10.1"
version = "0.11.0"
edition = "2021"

[[bin]]
name = "rgl"

[dependencies]
anyhow = "1.0.86"
clap = { version = "4.5.8", features = ["cargo", "derive"] }
clap = { version = "4.5.16", features = ["cargo", "derive"] }
dialoguer = "0.11.0"
dunce = "1.0.4"
dunce = "1.0.5"
enum_dispatch = "0.3.13"
fslock = "0.2.1"
indexmap = { version = "2.2.6", features = ["serde"] }
indexmap = { version = "2.4.0", features = ["serde"] }
notify = "6.1.1"
notify-debouncer-mini = "0.4.1"
once_cell = "1.19.0"
paris = { version = "1.5.15", features = ["macros"] }
rayon = "1.10.0"
semver = "1.0.23"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.120"
tempfile = "3.10.1"
ureq = "2.9.7"
uuid = { version = "1.9.1", features = ["v4"] }
serde = { version = "1.0.208", features = ["derive"] }
serde_json = "1.0.125"
strum = { version = "0.26.3", features = ["derive"] }
tempfile = "3.12.0"
ureq = "2.10.1"
uuid = { version = "1.10.0", features = ["v4"] }
walkdir = "2.5.0"
zip = "0.6.6"
14 changes: 11 additions & 3 deletions src/commands/add.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::Command;
use crate::info;
use crate::rgl::{Config, RemoteFilter, Session};
use crate::{info, warn};
use anyhow::Result;
use clap::Args;

Expand All @@ -9,6 +9,8 @@ use clap::Args;
pub struct Add {
#[arg(required = true)]
filters: Vec<String>,
#[arg(short, long, default_missing_value = "default", num_args = 0..)]
profile: Vec<String>,
#[arg(short, long)]
force: bool,
}
Expand All @@ -22,9 +24,15 @@ impl Command for Add {
info!("Adding filter <b>{}</>...", arg);
let (name, remote) = RemoteFilter::parse(arg)?;
remote.install(&name, Some(&data_path), self.force)?;

info!("Filter <b>{name}</> successfully added");
for profile_name in &self.profile {
if config.add_filter_to_profile(&name, profile_name) {
info!("Added filter <b>{name}</> to <b>{profile_name}</> profile");
} else {
warn!("Profile <b>{profile_name}</> not found, skipping...");
}
}
config.add_filter(&name, &remote.into())?;
info!("Filter <b>{name}</> successfully added");
}
config.save()?;
session.unlock()
Expand Down
4 changes: 2 additions & 2 deletions src/commands/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ impl Command for Get {
let config = Config::load()?;
let mut session = Session::lock()?;
let data_path = config.get_data_path();
for (name, value) in config.get_filters() {
match FilterDefinition::from_value(value)? {
for (name, filter) in config.get_filters()? {
match filter {
FilterDefinition::Remote(remote) => {
info!("Downloading filter <b>{name}</>...");
remote.install(&name, Some(&data_path), false)?;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::Command;
use crate::rgl::{get_cache_dir, get_global_filters_path, get_user_config_path};
use crate::Command;
use anyhow::Result;
use clap::{crate_version, Args};

Expand Down
13 changes: 4 additions & 9 deletions src/commands/list.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::Command;
use crate::log;
use crate::rgl::{Config, FilterDefinition, GlobalFilters};
use anyhow::{Context, Result};
use anyhow::Result;
use clap::Args;

/// List filters defined in the `config.json` file
Expand Down Expand Up @@ -29,15 +29,10 @@ fn list_project() -> Result<()> {

let mut local_filters = vec![];
let mut remote_filters = vec![];
for (name, value) in config.get_filters() {
let filter = FilterDefinition::from_value(value.to_owned())?;
for (name, filter) in config.get_filters()? {
match filter {
FilterDefinition::Local(_) => {
let run_with = value["runWith"]
.as_str()
.context("Invalid filter definition")?
.to_owned();
local_filters.push((name, run_with));
FilterDefinition::Local(filter) => {
local_filters.push((name, filter.to_string()));
}
FilterDefinition::Remote(filter) => {
remote_filters.push((name, filter.version));
Expand Down
Loading

0 comments on commit 8d25448

Please sign in to comment.