mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
cli improvements, added examples to nightly package
This commit is contained in:
parent
2a45798cba
commit
46a09d81e8
3 changed files with 19 additions and 8 deletions
|
@ -108,12 +108,14 @@ test-all:
|
|||
|
||||
build-nightly-release:
|
||||
FROM +test-rust
|
||||
COPY --dir .git ./
|
||||
COPY --dir .git LICENSE LEGAL_DETAILS ./
|
||||
# version.txt is used by the CLI: roc --version
|
||||
RUN printf "nightly pre-release, built from commit " > version.txt
|
||||
RUN git log --pretty=format:'%h' -n 1 >> version.txt
|
||||
RUN printf " on: " >> version.txt
|
||||
RUN date >> version.txt
|
||||
RUN cargo build --features with_sound --release
|
||||
RUN cd ./target/release && tar -czvf roc_linux_x86_64.tar.gz ./roc
|
||||
RUN cd ./target/release && tar -czvf roc_linux_x86_64.tar.gz ./roc ../../LICENSE ../../LEGAL_DETAILS ../../examples/hello-world ../../examples/hello-rust ../../examples/hello-zig ../../compiler/builtins/bitcode/src/ ../../roc_std
|
||||
SAVE ARTIFACT ./target/release/roc_linux_x86_64.tar.gz AS LOCAL roc_linux_x86_64.tar.gz
|
||||
|
||||
# compile everything needed for benchmarks and output a self-contained dir from which benchmarks can be run.
|
||||
|
|
|
@ -23,6 +23,7 @@ pub const CMD_REPL: &str = "repl";
|
|||
pub const CMD_EDIT: &str = "edit";
|
||||
pub const CMD_DOCS: &str = "docs";
|
||||
pub const CMD_CHECK: &str = "check";
|
||||
pub const CMD_VERSION: &str = "version";
|
||||
|
||||
pub const FLAG_DEBUG: &str = "debug";
|
||||
pub const FLAG_DEV: &str = "dev";
|
||||
|
@ -103,8 +104,11 @@ pub fn build_app<'a>() -> App<'a> {
|
|||
.subcommand(App::new(CMD_REPL)
|
||||
.about("Launch the interactive Read Eval Print Loop (REPL)")
|
||||
)
|
||||
.subcommand(App::new(CMD_VERSION)
|
||||
.about("Print version information")
|
||||
)
|
||||
.subcommand(App::new(CMD_CHECK)
|
||||
.about("Build a binary from the given .roc file, but don't run it")
|
||||
.about("When developing, it's recommended to run `check` before `build`. It may provide a useful error message in cases where `build` panics")
|
||||
.arg(
|
||||
Arg::new(FLAG_TIME)
|
||||
.long(FLAG_TIME)
|
||||
|
@ -190,7 +194,7 @@ pub fn build_app<'a>() -> App<'a> {
|
|||
|
||||
if cfg!(feature = "editor") {
|
||||
app.subcommand(
|
||||
App::new(CMD_EDIT).about("Launch the Roc editor").arg(
|
||||
App::new(CMD_EDIT).about("Launch the Roc editor (Work In Progress)").arg(
|
||||
Arg::new(DIRECTORY_OR_FILES)
|
||||
.index(1)
|
||||
.multiple_values(true)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use roc_cli::build::check_file;
|
||||
use roc_cli::{
|
||||
build_app, docs, repl, BuildConfig, CMD_BUILD, CMD_CHECK, CMD_DOCS, CMD_EDIT, CMD_REPL,
|
||||
DIRECTORY_OR_FILES, FLAG_TIME, ROC_FILE,
|
||||
};
|
||||
use roc_cli::{BuildConfig, CMD_BUILD, CMD_CHECK, CMD_DOCS, CMD_EDIT, CMD_REPL, CMD_VERSION, DIRECTORY_OR_FILES, FLAG_TIME, ROC_FILE, build_app, docs, repl};
|
||||
use roc_load::file::LoadingProblem;
|
||||
use std::fs::{self, FileType};
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[macro_use]
|
||||
extern crate const_format;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
|
@ -122,6 +122,11 @@ fn main() -> io::Result<()> {
|
|||
|
||||
Ok(0)
|
||||
}
|
||||
Some(CMD_VERSION) => {
|
||||
println!("roc {}", concatcp!(include_str!("../../version.txt"), "\n"));
|
||||
|
||||
Ok(0)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue