Skip to content

Commit

Permalink
build: updated core
Browse files Browse the repository at this point in the history
  • Loading branch information
johnstonskj committed Feb 20, 2024
1 parent 3dcf377 commit 21dcdce
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 37 deletions.
12 changes: 6 additions & 6 deletions sdml-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "sdml-cli"
description = "Rust CLI for Simple Domain Modeling Language (SDML)"
version = "0.2.7"
version = "0.2.8"
authors = ["Simon Johnston <johnstonskj@gmail.com>"]
repository = "https://github.com/johnstonskj/rust-sdml.git"
license-file = "../LICENSE"
readme = "README.md"
readme = "README.org"
edition = "2021"
publish = true

Expand All @@ -20,10 +20,10 @@ all-features = true
[dependencies]
clap = { version = "4.5", features = ["derive", "env", "wrap_help"] }
human-panic = "1.2.3"
sdml-core = { version = "0.2.11", features = ["serde", "terms"], path = "../sdml-core" }
sdml_error = { version = "0.1.3", path = "../sdml_error" }
sdml-generate = { version = "0.2.7", path = "../sdml-generate" }
sdml-parse = { version = "0.2.9", path = "../sdml-parse" }
sdml-core = { version = "0.2.14", features = ["serde", "terms"], path = "../sdml-core" }
sdml_error = { version = "0.1.5", path = "../sdml_error" }
sdml-generate = { version = "0.2.10", path = "../sdml-generate" }
sdml-parse = { version = "0.2.11", path = "../sdml-parse" }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tree-sitter-sdml = "0.2.12"
4 changes: 4 additions & 0 deletions sdml-cli/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ end

* Changes

*Version 0.2.8*

- Build: upgrade to =sdml_core= version =0.2.14= and the new =ModelStore= trait.

*Version 0.2.7*

- Feature: better error handling in conjunction with the validation and diagnostics in =sdml_error=.
Expand Down
66 changes: 35 additions & 31 deletions sdml-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::builder::FalseyValueParser;
use clap::{Args, Parser, Subcommand, ValueEnum};
use sdml_core::cache::ModuleCache;
use sdml_core::cache::{ModuleCache, ModuleStore};
use sdml_core::load::{ModuleLoader, ModuleResolver};
use sdml_core::model::check::terms::{default_term_set, validate_module_terms};
use sdml_core::model::identifiers::Identifier;
Expand All @@ -15,7 +15,7 @@ use std::io::Read;
use std::path::PathBuf;
use std::process::ExitCode;
use std::str::FromStr;
use tracing::{error, info};
use tracing::{error, info, trace};
use tracing_subscriber::filter::EnvFilter;
use tracing_subscriber::filter::LevelFilter as TracingLevelFilter;
use tracing_subscriber::FmtSubscriber;
Expand Down Expand Up @@ -70,24 +70,24 @@ enum LogFilter {

#[derive(Subcommand, Debug)]
enum Commands {
/// Validate a module
Validate(Validate),
/// Document a module
Doc(Doc),
/// Show module dependencies
Deps(Deps),
/// Extract tags from a module
Tags(Tags),
/// Syntax highlight a module source
Highlight(Highlight),
/// Convert module into alternate representations
Convert(Convert),
/// Draw diagrams from a module
Draw(Draw),
/// View formatted module source code
View(View),
/// Show module dependencies
Deps(Deps),
/// Document a module
Doc(Doc),
/// Syntax highlight a module source
Highlight(Highlight),
/// Extract tags from a module
Tags(Tags),
/// Validate a module
Validate(Validate),
/// Show tool and library versions.
Versions,
/// View formatted module source code
View(View),
}

// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -226,12 +226,12 @@ struct Deps {

#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum DepsFormat {
/// A hierarchical tree format
Tree,
/// GraphViz DOT format
Graph,
/// As RDF/OWL import triples
Rdf,
/// A hierarchical tree format
Tree,
}

// ------------------------------------------------------------------------------------------------
Expand All @@ -250,10 +250,10 @@ struct Doc {

#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum DocFormat {
/// Emacs org-mode
OrgMode,
/// Markdown
Markdown,
/// Emacs org-mode
OrgMode,
}

// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -291,12 +291,12 @@ struct Convert {

#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum ConvertFormat {
/// RDF Abstract Model
Rdf,
/// JSON
Json,
/// Pretty-printed JSON
JsonPretty,
/// RDF Abstract Model
Rdf,
/// S-Expressions
SExpr,
}
Expand Down Expand Up @@ -408,16 +408,6 @@ fn main() -> ExitCode {
}
}

// ------------------------------------------------------------------------------------------------
// Main ❱ Color
// ------------------------------------------------------------------------------------------------

fn init_color(no_color: bool) {
if no_color {
sdml_generate::color::set_colorize(sdml_error::diagnostics::UseColor::Never);
}
}

// ------------------------------------------------------------------------------------------------
// Main ❱ Logging
// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -446,6 +436,17 @@ fn init_logging(log_filter: LogFilter) -> Result<(), Error> {
Ok(())
}

// ------------------------------------------------------------------------------------------------
// Main ❱ Color
// ------------------------------------------------------------------------------------------------

fn init_color(no_color: bool) {
if no_color {
info!("Turning off color");
sdml_generate::color::set_colorize(sdml_error::diagnostics::UseColor::Never);
}
}

// ------------------------------------------------------------------------------------------------
// Command Wrappers
// ------------------------------------------------------------------------------------------------
Expand All @@ -460,6 +461,7 @@ trait Execute {

impl Execute for Commands {
fn execute(&self) -> Result<(), Error> {
trace!("Commands::execute self: {self:?}");
match self {
Commands::Highlight(cmd) => cmd.execute(),
Commands::Doc(cmd) => cmd.execute(),
Expand Down Expand Up @@ -817,7 +819,9 @@ impl From<DepsFormat> for sdml_generate::actions::deps::DependencyViewRepresenta
sdml_generate::actions::deps::DependencyViewRepresentation::TextTree
}
DepsFormat::Graph => {
sdml_generate::actions::deps::DependencyViewRepresentation::DotGraph
sdml_generate::actions::deps::DependencyViewRepresentation::DotGraph(
Default::default(),
)
}
DepsFormat::Rdf => {
sdml_generate::actions::deps::DependencyViewRepresentation::RdfImports
Expand Down

0 comments on commit 21dcdce

Please sign in to comment.