guartcl 0.5.0-beta2

Enhanced Jim Tcl.
Documentation
#![doc = include_str!("../README.md")]
#![deny(unsafe_code)]

mod binary;
mod parse;
mod typedata;
pub mod usage;
mod uuid;

pub use jimtcl as jim;
pub use jimtcl::{Interp, JimError, JimObject, JimResult};

/// Create an interpreter with added Guardian commands.
pub fn guardian_interp() -> JimResult<Interp> {
    let interp = Interp::new()?;

    interp.add_command("parse json", parse::parse_json)?;
    interp.add_command("parse toml", parse::parse_toml)?;
    interp.add_command("parse yaml", parse::parse_yaml)?;
    interp.eval("ensemble parse")?;

    interp.add_command("td type", typedata::td_type)?;
    interp.add_command("td length", typedata::td_length)?;

    interp.add_command("td null", typedata::td_null)?;
    interp.add_command("td boolean", typedata::td_boolean)?;
    interp.add_command("td integer", typedata::td_integer)?;
    interp.add_command("td float", typedata::td_float)?;
    interp.add_command("td string", typedata::td_string)?;
    interp.add_command("td list", typedata::td_list)?;
    interp.add_command("td record", typedata::td_record)?;

    interp.add_command("td get", typedata::td_get)?;
    interp.add_command("td set", typedata::td_set)?;
    interp.add_command("td lappend", typedata::td_lappend)?;
    interp.add_command("td native", typedata::td_native)?;
    interp.add_command("td coalesce", typedata::td_coalesce)?;

    interp.add_command("td parse json", typedata::td_parse_json)?;
    interp.add_command("td parse yaml", typedata::td_parse_yaml)?;
    interp.add_command("td parse toml", typedata::td_parse_toml)?;
    interp.eval("ensemble {td parse}")?;

    interp.add_command("td dump json", typedata::td_dump_json)?;
    interp.add_command("td dump toml", typedata::td_dump_toml)?;
    interp.add_command("td dump yaml", typedata::td_dump_yaml)?;
    interp.eval("ensemble {td dump}")?;

    interp.eval("ensemble td")?;

    interp.add_command("uuid v3", uuid::uuid_v3)?;
    interp.add_command("uuid v4", uuid::uuid_v4)?;
    interp.add_command("uuid random", uuid::uuid_v4)?;
    interp.add_command("uuid v5", uuid::uuid_v5)?;
    interp.add_command("uuid v7", uuid::uuid_v7)?;
    interp.add_command("uuid version", uuid::uuid_version)?;
    interp.add_command("uuid timestamp", uuid::uuid_timestamp)?;
    interp.add_command("uuid binary", uuid::uuid_binary)?;
    interp.eval("ensemble uuid")?;

    interp.add_command("binary encode base64", binary::bin_encode_base64)?;
    interp.add_command("binary decode base64", binary::bin_decode_base64)?;
    interp.add_command("binary encode base32", binary::bin_encode_base32)?;
    interp.add_command("binary decode base32", binary::bin_decode_base32)?;
    interp.add_command("binary encode base58", binary::bin_encode_base58)?;
    interp.add_command("binary decode base58", binary::bin_decode_base58)?;
    interp.add_command("binary encode hex", binary::bin_encode_hex)?;
    interp.add_command("binary decode hex", binary::bin_decode_hex)?;
    interp.eval("ensemble {binary encode}")?;
    interp.eval("ensemble {binary decode}")?;
    interp.add_command("binary random", binary::bin_random)?;

    Ok(interp)
}