Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ClueLang/Clue
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiori44 committed Mar 18, 2022
2 parents aa4cfab + 3e16e46 commit 4a2f29d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Felice D'Angelo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 11 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ struct Cli {
/// The path to the directory where the *.clue files are located.
/// Every directory inside the given directory will be checked too.
/// If the path points to a single *.clue file, only that file will be compiled.
path: String,
#[clap(required_unless_present = "license")]
path: Option<String>,

/// The name the output file will have
#[clap(default_value = "main", value_name = "OUTPUT FILE NAME")]
outputname: String,

/// Print license information
#[clap(short = 'L', long, display_order = 1000)]
license: bool,

/// Print list of detected tokens in compiled files
#[clap(long)]
tokens: bool,
Expand Down Expand Up @@ -141,6 +146,10 @@ fn CompileFolder(path: &Path, rpath: String) -> Result<(), String> {

fn main() -> Result<(), String> {
let cli = Cli::parse();
if cli.license {
println!("{}", include_str!("../LICENSE"));
return Ok(());
}
unsafe {
ENV_TOKENS = cli.tokens;
ENV_STRUCT = cli.r#struct;
Expand All @@ -155,7 +164,7 @@ fn main() -> Result<(), String> {
if let Some(bit) = arg!(&ENV_JITBIT) {
AddToOutput(&format!("local {} = require(\"bit\");\n", bit));
}
let codepath = &cli.path;
let codepath = cli.path.unwrap();
if arg!(ENV_PATHISCODE) {
let code = CompileCode(codepath.clone(), String::from("(command line)"), 0)?;
println!("{}", code);
Expand Down

0 comments on commit 4a2f29d

Please sign in to comment.