Skip to main content

Crate tsh

Crate tsh 

Source
Expand description

Compile a statically checked TypeScript subset to standalone shell source.

use tsh::{compile_source, CompileOptions, TargetOs};

let options = CompileOptions { os: TargetOs::Linux, ..Default::default() };
let script = compile_source("hello.tsh", "echo('Hello');", &options)?;
assert!(script.starts_with("#!/usr/bin/env bash"));

Re-exports§

pub use compiler::diagnostics::CompileError;
pub use compiler::check_file;
pub use compiler::compile_file;
pub use compiler::compile_source;
pub use options::Comments;
pub use options::CompileOptions;
pub use options::Target;
pub use options::TargetOs;

Modules§

backends
Target backends for typed-shell IR.
compiler
ir
Target-independent, typed language semantics.
options
runner
Execute a temporary generated script, retaining stdin for the program.