Skip to content

Commit 7ac5aa1

Browse files
authored
rust(feature): Sift CLI (#336)
1 parent 6d6799a commit 7ac5aa1

25 files changed

Lines changed: 5679 additions & 924 deletions

rust/Cargo.lock

Lines changed: 2710 additions & 924 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ members = [
77
"crates/sift_error",
88
"crates/sift_connect",
99
"crates/sift_stream_bindings",
10+
"crates/sift_cli",
1011
]
1112

1213
[workspace.package]

rust/crates/sift_cli/Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[package]
2+
name = "sift_cli"
3+
authors.workspace = true
4+
version.workspace = true
5+
edition.workspace = true
6+
categories.workspace = true
7+
homepage.workspace = true
8+
repository.workspace = true
9+
keywords.workspace = true
10+
readme.workspace = true
11+
license.workspace = true
12+
description = "CLI to streamline programmatic workflows with Sift's API"
13+
14+
[dependencies]
15+
anyhow = "1.0.100"
16+
chrono.workspace = true
17+
clap = { version = "4.5.48", features = ["cargo", "derive", "wrap_help"] }
18+
clap_complete = "4.5.58"
19+
crossterm = "0.29.0"
20+
csv = "1.3.1"
21+
dirs = "6.0.0"
22+
flate2 = "1.1.2"
23+
indicatif = "0.18.0"
24+
parquet = "56.2.0"
25+
pbjson-types = { workspace = true }
26+
reqwest = "0.12.23"
27+
sift_rs = { workspace = true }
28+
tokio = { version = "1.47.1", features = ["full", "net", "time"] }
29+
toml = "0.8.23"
30+
zip = "6.0.0"
31+
32+
[dev-dependencies]
33+
indoc = "2.0.6"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
use clap::ValueEnum;
2+
use sift_rs::common::r#type::v1::ChannelDataType;
3+
4+
#[derive(Debug, Clone, ValueEnum)]
5+
pub enum DataType {
6+
/// Asks the program to infer the type so user can just focus on setting things like unit,
7+
/// description, etc.
8+
Infer,
9+
Double,
10+
String,
11+
Enum,
12+
BitField,
13+
Bool,
14+
Float,
15+
Int32,
16+
Uint32,
17+
Int64,
18+
Uint64,
19+
Bytes,
20+
}
21+
22+
impl From<DataType> for ChannelDataType {
23+
fn from(dt: DataType) -> Self {
24+
match dt {
25+
DataType::Double => Self::Double,
26+
DataType::String => Self::String,
27+
DataType::Enum => Self::Enum,
28+
DataType::BitField => Self::BitField,
29+
DataType::Bool => Self::Bool,
30+
DataType::Float => Self::Float,
31+
DataType::Int32 => Self::Int32,
32+
DataType::Uint32 => Self::Uint32,
33+
DataType::Int64 => Self::Int64,
34+
DataType::Uint64 => Self::Uint64,
35+
DataType::Bytes => Self::Bytes,
36+
DataType::Infer => Self::Unspecified,
37+
}
38+
}
39+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use clap::ValueEnum;
2+
use sift_rs::exports::v1::ExportOutputFormat;
3+
4+
#[derive(Debug, Copy, Clone, ValueEnum)]
5+
pub enum Format {
6+
Csv,
7+
Sun,
8+
}
9+
10+
impl From<Format> for ExportOutputFormat {
11+
fn from(val: Format) -> Self {
12+
match val {
13+
Format::Csv => ExportOutputFormat::Csv,
14+
Format::Sun => ExportOutputFormat::Sun,
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)