refactor: cli to be a binary with cli feature
This commit is contained in:
parent
009ae67734
commit
635bd84384
15
Cargo.toml
15
Cargo.toml
|
@ -5,9 +5,11 @@ description = "A Rust crate for querying the Tesla API."
|
|||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[lib]
|
||||
name = "teslatte"
|
||||
path = "src/lib.rs"
|
||||
[features]
|
||||
default = ["cli", "fancy"]
|
||||
|
||||
fancy = ["miette/fancy"]
|
||||
cli = ["dep:clap", "dep:tracing-subscriber"]
|
||||
|
||||
[dependencies]
|
||||
miette = { version = "5.1", features = ["fancy"] }
|
||||
|
@ -26,7 +28,8 @@ urlencoding = "2.1.0"
|
|||
derive_more = "0.99"
|
||||
pkce = "0.2.0"
|
||||
|
||||
clap = { version = "3.2", features = ["derive", "env"], optional = true }
|
||||
tracing-subscriber = { version = "0.3.17", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
test-log = { version = "0.2", default-features = false, features = ["trace"] }
|
||||
tracing-subscriber = "0.3"
|
||||
clap = { version = "3.2", features = ["derive", "env"]}
|
||||
test-log = { version = "0.2.12", default-features = false, features = ["trace"] }
|
||||
|
|
1
src/cli.rs
Normal file
1
src/cli.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod vehicle;
|
|
@ -1,10 +1,6 @@
|
|||
use crate::vehicles::{SetChargeLimit, SetChargingAmps};
|
||||
use crate::{Api, VehicleId};
|
||||
use clap::{Args, Subcommand};
|
||||
use teslatte::vehicles::{SetChargeLimit, SetChargingAmps};
|
||||
use teslatte::{Api, VehicleId};
|
||||
|
||||
pub fn main() {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[derive(Debug, Args)]
|
||||
pub struct VehicleArgs {
|
|
@ -14,6 +14,9 @@ pub mod error;
|
|||
pub mod powerwall;
|
||||
pub mod vehicles;
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
pub mod cli;
|
||||
|
||||
const API_URL: &str = "https://owner-api.teslamotors.com/api/1";
|
||||
|
||||
trait Values {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
mod cli_vehicle;
|
||||
|
||||
use chrono::DateTime;
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use cli_vehicle::VehicleArgs;
|
||||
use miette::{IntoDiagnostic, WrapErr};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use teslatte::auth::{AccessToken, RefreshToken};
|
||||
use teslatte::calendar_history::{CalendarHistoryValues, HistoryKind, HistoryPeriod};
|
||||
use teslatte::cli::vehicle::VehicleArgs;
|
||||
use teslatte::energy::EnergySiteId;
|
||||
use teslatte::powerwall::{PowerwallEnergyHistoryValues, PowerwallId};
|
||||
use teslatte::Api;
|
Loading…
Reference in a new issue