Skip to content

Commit

Permalink
Separate floccus-cli (binary) from floccus-xbel (lib)
Browse files Browse the repository at this point in the history
  • Loading branch information
sydhds committed Nov 6, 2024
1 parent f78b7ff commit 4444d28
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 55 deletions.
91 changes: 61 additions & 30 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[package]
name = "floccus-cli"
version = "0.1.0"
edition = "2021"
[workspace]
members = [
"floccus-xbel",
"floccus-cli",
]
resolver = "2"

[profile.release]
codegen-units = 1
lto = "fat"

[dependencies]
[workspace.dependencies]
clap = { version = "4.5.20", features = ["derive"] }
serde = { version = "1.0.214", features = ["derive"] }
git2 = "0.19.0"
url = { version = "2.5.3", features = ["serde"] }
quick-xml = { version = "0.37.0", features = ["serde", "serialize"] }
directories = "5.0.1"
thiserror = "1.0.68"
thiserror = "2.0.0"
toml = "0.8.19"
toml_edit = "0.22.22"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tracing = "0.1.40"

[dev-dependencies]
tracing-test = "0.2.5"
20 changes: 20 additions & 0 deletions floccus-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "floccus-cli"
version = "0.1.0"
edition = "2021"

[dependencies]
clap = {workspace = true}
serde = {workspace = true}
git2 = {workspace = true}
url = {workspace = true}
directories = {workspace = true}
thiserror = {workspace = true}
toml = {workspace = true}
toml_edit = {workspace = true}
tracing-subscriber = {workspace = true}
tracing = {workspace = true}
floccus-xbel = {path = "../floccus-xbel"}

[dev-dependencies]
tracing-test = {workspace = true}
2 changes: 1 addition & 1 deletion src/cli/cli_args.rs → floccus-cli/src/cli/cli_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ mod tests {
"--disable-push",
]);
let config: FloccusCliConfig = toml::from_str(CONFIG_1).unwrap();
override_cli_with(&mut cli, config);
override_cli_with(&mut cli, config).unwrap();

if let Commands::Rm(rm_args) = cli.command {
// Note: disable-push is set to false in config and then override by command line
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/main.rs → floccus-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod cli;
mod git;
mod xbel;
// mod xbel;

// std
use std::borrow::Cow;
Expand All @@ -22,7 +22,7 @@ use crate::cli::{
RemoveArgs, Under,
};
use crate::git::{git_clone, git_fetch, git_merge, git_push};
use crate::xbel::{Xbel, XbelError, XbelItem, XbelItemOrEnd, XbelNestingIterator, XbelPath};
use floccus_xbel::{Xbel, XbelError, XbelItem, XbelItemOrEnd, XbelNestingIterator, XbelPath};

const FLOCCUS_CLI_CONFIG_ENV: &str = "FLOCCUS_CLI_CONFIG";
const FLOCCUS_CLI_QUALIFIER: &str = "app";
Expand Down
13 changes: 13 additions & 0 deletions floccus-xbel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "floccus-xbel"
version = "0.1.0"
edition = "2021"

[dependencies]
quick-xml = {workspace = true}
serde = {workspace = true}
thiserror = {workspace = true}

[dev-dependencies]
tracing = {workspace = true}
tracing-test = {workspace = true}
2 changes: 1 addition & 1 deletion src/xbel/mod.rs → floccus-xbel/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod xbel_format;
pub mod xbel_format;

pub use xbel_format::{Xbel, XbelError, XbelItem, XbelPath};
pub use xbel_format::{XbelItemOrEnd, XbelNestingIterator};
Loading

0 comments on commit 4444d28

Please sign in to comment.