Skip to content

Commit

Permalink
CLI-only code behind a feature flag (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchalmers authored Sep 19, 2023
1 parent bc7e9d9 commit 8147f5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/wasm-lib/kcl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT"
[dependencies]
anyhow = { version = "1.0.75", features = ["backtrace"] }
async-trait = "0.1.73"
clap = { version = "4.4.3", features = ["cargo", "derive", "env", "unicode"] }
clap = { version = "4.4.3", features = ["cargo", "derive", "env", "unicode"], optional = true }
dashmap = "5.5.3"
derive-docs = { version = "0.1.3" }
#derive-docs = { path = "../derive-docs" }
Expand All @@ -19,7 +19,7 @@ lazy_static = "1.4.0"
parse-display = "0.8.2"
regex = "1.7.1"
schemars = { version = "0.8", features = ["impl_json_schema", "url", "uuid1"] }
serde = {version = "1.0.188", features = ["derive"] }
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
thiserror = "1.0.48"
ts-rs = { version = "7", package = "ts-rs-json-value", features = ["serde-json-impl", "schemars-impl", "uuid-impl"] }
Expand All @@ -42,6 +42,7 @@ tower-lsp = { version = "0.20.0", features = ["proposed"] }

[features]
default = ["engine"]
cli = ["dep:clap"]
engine = []

[profile.release]
Expand Down
8 changes: 5 additions & 3 deletions src/wasm-lib/kcl/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
use std::collections::HashMap;

use anyhow::Result;
#[cfg(feature = "cli")]
use clap::Parser;
use dashmap::DashMap;
use tower_lsp::{jsonrpc::Result as RpcResult, lsp_types::*, Client, LanguageServer};

use crate::{ast::types::VariableKind, executor::SourceRange, parser::PIPE_OPERATOR};

/// A subcommand for running the server.
#[derive(Parser, Clone, Debug)]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "cli", derive(Parser))]
pub struct Server {
/// Port that the server should listen
#[clap(long, default_value = "8080")]
#[cfg_attr(feature = "cli", clap(long, default_value = "8080"))]
pub socket: i32,

/// Listen over stdin and stdout instead of a tcp socket.
#[clap(short, long, default_value = "false")]
#[cfg_attr(feature = "cli", clap(short, long, default_value = "false"))]
pub stdio: bool,
}

Expand Down

1 comment on commit 8147f5f

@vercel
Copy link

@vercel vercel bot commented on 8147f5f Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.