Move deltachat-repl into a separate crate

This commit is contained in:
link2xt
2023-02-11 12:19:07 +00:00
parent d1702e3081
commit 46143ac54f
9 changed files with 46 additions and 19 deletions

View File

@@ -31,7 +31,7 @@ jobs:
override: true override: true
- name: Cache rust cargo artifacts - name: Cache rust cargo artifacts
uses: swatinem/rust-cache@v2 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: docs:
name: Rust doc comments name: Rust doc comments
@@ -89,7 +89,7 @@ jobs:
uses: swatinem/rust-cache@v2 uses: swatinem/rust-cache@v2
- name: check - name: check
run: cargo check --all --bins --examples --tests --features repl --benches run: cargo check --all --bins --examples --tests --benches
- name: tests - name: tests
run: cargo test --all run: cargo test --all

View File

@@ -20,10 +20,10 @@ jobs:
override: true override: true
- name: build - name: build
run: cargo build --example repl --features repl,vendored run: cargo build --example repl --features vendored
- name: Upload binary - name: Upload binary
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: repl.exe name: repl.exe
path: 'target/debug/examples/repl.exe' path: 'target/debug/deltachat-repl.exe'

17
Cargo.lock generated
View File

@@ -908,7 +908,6 @@ dependencies = [
"chrono", "chrono",
"criterion", "criterion",
"deltachat_derive", "deltachat_derive",
"dirs",
"email", "email",
"encoded-words", "encoded-words",
"escaper", "escaper",
@@ -943,7 +942,6 @@ dependencies = [
"reqwest", "reqwest",
"rusqlite", "rusqlite",
"rust-hsluv", "rust-hsluv",
"rustyline",
"sanitize-filename", "sanitize-filename",
"serde", "serde",
"serde_json", "serde_json",
@@ -988,6 +986,21 @@ dependencies = [
"yerpc", "yerpc",
] ]
[[package]]
name = "deltachat-repl"
version = "1.107.0"
dependencies = [
"ansi_term",
"anyhow",
"deltachat",
"dirs",
"log",
"pretty_env_logger",
"rusqlite",
"rustyline",
"tokio",
]
[[package]] [[package]]
name = "deltachat-rpc-server" name = "deltachat-rpc-server"
version = "1.107.0" version = "1.107.0"

View File

@@ -28,7 +28,6 @@ deltachat_derive = { path = "./deltachat_derive" }
format-flowed = { path = "./format-flowed" } format-flowed = { path = "./format-flowed" }
ratelimit = { path = "./deltachat-ratelimit" } ratelimit = { path = "./deltachat-ratelimit" }
ansi_term = { version = "0.12.1", optional = true }
anyhow = "1" anyhow = "1"
async-imap = { git = "https://github.com/async-email/async-imap", branch = "master", default-features = false, features = ["runtime-tokio"] } 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"] } async-native-tls = { version = "0.4", default-features = false, features = ["runtime-tokio"] }
@@ -40,7 +39,6 @@ backtrace = "0.3"
base64 = "0.21" base64 = "0.21"
bitflags = "1.3" bitflags = "1.3"
chrono = { version = "0.4", default-features=false, features = ["clock", "std"] } 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" } email = { git = "https://github.com/deltachat/rust-email", branch = "master" }
encoded-words = { git = "https://github.com/async-email/encoded-words", branch = "master" } encoded-words = { git = "https://github.com/async-email/encoded-words", branch = "master" }
escaper = "0.1" escaper = "0.1"
@@ -50,7 +48,6 @@ image = { version = "0.24.5", default-features=false, features = ["gif", "jpeg",
kamadak-exif = "0.5" kamadak-exif = "0.5"
lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" } lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" }
libc = "0.2" libc = "0.2"
log = {version = "0.4.16", optional = true }
mailparse = "0.14" mailparse = "0.14"
native-tls = "0.2" native-tls = "0.2"
num_cpus = "1.15" num_cpus = "1.15"
@@ -67,7 +64,6 @@ rand = "0.8"
regex = "1.7" regex = "1.7"
rusqlite = { version = "0.27", features = ["sqlcipher"] } rusqlite = { version = "0.27", features = ["sqlcipher"] }
rust-hsluv = "0.1" rust-hsluv = "0.1"
rustyline = { version = "10", optional = true }
sanitize-filename = "0.4" sanitize-filename = "0.4"
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
@@ -109,18 +105,13 @@ members = [
"deltachat-jsonrpc", "deltachat-jsonrpc",
"deltachat-rpc-server", "deltachat-rpc-server",
"deltachat-ratelimit", "deltachat-ratelimit",
"deltachat-repl",
"format-flowed", "format-flowed",
] ]
[[example]] [[example]]
name = "simple" name = "simple"
path = "examples/simple.rs" path = "examples/simple.rs"
required-features = ["repl"]
[[example]]
name = "repl"
path = "examples/repl/main.rs"
required-features = ["repl"]
[[bench]] [[bench]]
@@ -154,7 +145,6 @@ harness = false
[features] [features]
default = ["vendored"] default = ["vendored"]
internals = [] internals = []
repl = ["internals", "rustyline", "log", "pretty_env_logger", "ansi_term", "dirs"]
vendored = [ vendored = [
"async-native-tls/vendored", "async-native-tls/vendored",
"rusqlite/bundled-sqlcipher-vendored-openssl", "rusqlite/bundled-sqlcipher-vendored-openssl",

View File

@@ -19,10 +19,19 @@ $ curl https://sh.rustup.rs -sSf | sh
Compile and run Delta Chat Core command line utility, using `cargo`: 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. 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): Configure your account (if not already configured):
``` ```

15
deltachat-repl/Cargo.toml Normal file
View File

@@ -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"] }

View File

@@ -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] #[tokio::main]
async fn main() { async fn main() {
pretty_env_logger::try_init_timed().ok(); pretty_env_logger::try_init_timed().ok();