1#![doc = include_str!("../README.md")]
2
3#[cfg(doc)]
4pub mod reference {
5 #![doc = include_str!("../reference.md")]
6}
7
8#[doc(hidden)]
9#[allow(unused)]
10pub use {
11 crate::{crates::*, hashing::*, run::*, toolchain::*, util::*},
12 ::{
13 cargo_lock::Lockfile,
14 eyre::Result,
15 heck::*,
16 quote::quote,
17 serde_json::{json, Value as Json},
18 std::{
19 self,
20 env::current_dir,
21 ffi::OsString,
22 os::unix::prelude::OsStrExt,
23 path::PathBuf,
24 time::{SystemTime, UNIX_EPOCH},
25 },
26 syn,
27 toml_edit::easy::{toml, Value as Toml},
28 },
29};
30
31#[doc(hidden)]
32pub mod crates;
33#[doc(hidden)]
34pub mod hashing;
35#[doc(hidden)]
36pub mod run;
37#[doc(hidden)]
38pub mod toolchain;
39#[doc(hidden)]
40pub mod util;
41
42#[doc(hidden)]
43pub fn main() -> eyre::Result<()> {
44 color_eyre::install()?;
45 env_logger::try_init()?;
46
47 let mut args = Vec::from_iter(std::env::args_os().skip(1));
48
49 if args.is_empty() {
50 args.splice(..0, ["help".into()]);
51 } else if is_path_like(args[0].as_bytes()) {
52 args.splice(..0, ["run".into()]);
53 }
54
55 match args[0].as_bytes() {
56 b"help" => help()?,
57 b"run" => run(PathBuf::from(&args[1]), &args[2..])?,
58 b"eval" => eval(
59 args[1..]
60 .iter()
61 .map(|s| s.to_str().unwrap())
62 .collect::<Vec<_>>()
63 .join(" "),
64 &[],
65 )?,
66 _ => {
67 eprintln!("no such command: {:?}", &args[0]);
68 help()?;
69 std::process::exit(1);
70 }
71 }
72
73 Ok(())
74}