diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e75931eb..e772952f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: override: true - name: Cache rust cargo artifacts uses: swatinem/rust-cache@v2 - - run: cargo clippy --workspace --tests --examples --benches --features repl -- -D warnings + - run: cargo clippy --workspace --tests --examples --benches -- -D warnings docs: name: Rust doc comments @@ -89,7 +89,7 @@ jobs: uses: swatinem/rust-cache@v2 - name: check - run: cargo check --all --bins --examples --tests --features repl --benches + run: cargo check --all --bins --examples --tests --benches - name: tests run: cargo test --all diff --git a/.github/workflows/repl.yml b/.github/workflows/repl.yml index c0a76fc37..55247c40d 100644 --- a/.github/workflows/repl.yml +++ b/.github/workflows/repl.yml @@ -20,10 +20,10 @@ jobs: override: true - name: build - run: cargo build --example repl --features repl,vendored + run: cargo build --example repl --features vendored - name: Upload binary uses: actions/upload-artifact@v3 with: name: repl.exe - path: 'target/debug/examples/repl.exe' + path: 'target/debug/deltachat-repl.exe' diff --git a/Cargo.lock b/Cargo.lock index 68281baab..f9a24f360 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -908,7 +908,6 @@ dependencies = [ "chrono", "criterion", "deltachat_derive", - "dirs", "email", "encoded-words", "escaper", @@ -943,7 +942,6 @@ dependencies = [ "reqwest", "rusqlite", "rust-hsluv", - "rustyline", "sanitize-filename", "serde", "serde_json", @@ -988,6 +986,21 @@ dependencies = [ "yerpc", ] +[[package]] +name = "deltachat-repl" +version = "1.107.0" +dependencies = [ + "ansi_term", + "anyhow", + "deltachat", + "dirs", + "log", + "pretty_env_logger", + "rusqlite", + "rustyline", + "tokio", +] + [[package]] name = "deltachat-rpc-server" version = "1.107.0" diff --git a/Cargo.toml b/Cargo.toml index 00f3947d0..82369afe9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,6 @@ deltachat_derive = { path = "./deltachat_derive" } format-flowed = { path = "./format-flowed" } ratelimit = { path = "./deltachat-ratelimit" } -ansi_term = { version = "0.12.1", optional = true } anyhow = "1" async-imap = { git = "https://github.com/async-email/async-imap", branch = "master", default-features = false, features = ["runtime-tokio"] } async-native-tls = { version = "0.4", default-features = false, features = ["runtime-tokio"] } @@ -40,7 +39,6 @@ backtrace = "0.3" base64 = "0.21" bitflags = "1.3" chrono = { version = "0.4", default-features=false, features = ["clock", "std"] } -dirs = { version = "4", optional=true } email = { git = "https://github.com/deltachat/rust-email", branch = "master" } encoded-words = { git = "https://github.com/async-email/encoded-words", branch = "master" } escaper = "0.1" @@ -50,7 +48,6 @@ image = { version = "0.24.5", default-features=false, features = ["gif", "jpeg", kamadak-exif = "0.5" lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" } libc = "0.2" -log = {version = "0.4.16", optional = true } mailparse = "0.14" native-tls = "0.2" num_cpus = "1.15" @@ -67,7 +64,6 @@ rand = "0.8" regex = "1.7" rusqlite = { version = "0.27", features = ["sqlcipher"] } rust-hsluv = "0.1" -rustyline = { version = "10", optional = true } sanitize-filename = "0.4" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } @@ -109,18 +105,13 @@ members = [ "deltachat-jsonrpc", "deltachat-rpc-server", "deltachat-ratelimit", + "deltachat-repl", "format-flowed", ] [[example]] name = "simple" path = "examples/simple.rs" -required-features = ["repl"] - -[[example]] -name = "repl" -path = "examples/repl/main.rs" -required-features = ["repl"] [[bench]] @@ -154,7 +145,6 @@ harness = false [features] default = ["vendored"] internals = [] -repl = ["internals", "rustyline", "log", "pretty_env_logger", "ansi_term", "dirs"] vendored = [ "async-native-tls/vendored", "rusqlite/bundled-sqlcipher-vendored-openssl", diff --git a/README.md b/README.md index 3ea334637..7e9f6b1eb 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,19 @@ $ curl https://sh.rustup.rs -sSf | sh Compile and run Delta Chat Core command line utility, using `cargo`: ``` -$ RUST_LOG=repl=info cargo run --example repl --features repl -- ~/deltachat-db +$ RUST_LOG=repl=info cargo run -p deltachat-repl -- ~/deltachat-db ``` where ~/deltachat-db is the database file. Delta Chat will create it if it does not exist. +Optionally, install `deltachat-repl` binary with +``` +$ cargo install --path deltachat-repl/ +``` +and run as +``` +$ deltachat-repl ~/deltachat-db +``` + Configure your account (if not already configured): ``` diff --git a/deltachat-repl/Cargo.toml b/deltachat-repl/Cargo.toml new file mode 100644 index 000000000..189c592f8 --- /dev/null +++ b/deltachat-repl/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "deltachat-repl" +version = "1.107.0" +edition = "2021" + +[dependencies] +ansi_term = "0.12.1" +anyhow = "1" +deltachat = { path = "..", features = ["internals"]} +dirs = "4" +log = "0.4.16" +pretty_env_logger = "0.4" +rusqlite = "0.27" +rustyline = "10" +tokio = { version = "1", features = ["fs", "rt-multi-thread", "macros"] } diff --git a/examples/repl/cmdline.rs b/deltachat-repl/src/cmdline.rs similarity index 100% rename from examples/repl/cmdline.rs rename to deltachat-repl/src/cmdline.rs diff --git a/examples/repl/main.rs b/deltachat-repl/src/main.rs similarity index 100% rename from examples/repl/main.rs rename to deltachat-repl/src/main.rs diff --git a/examples/simple.rs b/examples/simple.rs index c75af319a..cca50bb27 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -28,7 +28,7 @@ fn cb(event: EventType) { } } -/// Run with `RUST_LOG=simple=info cargo run --release --example simple --features repl -- email pw`. +/// Run with `RUST_LOG=simple=info cargo run --release --example simple -- email pw`. #[tokio::main] async fn main() { pretty_env_logger::try_init_timed().ok();