-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
--json
argument to all commands (#38)
- Loading branch information
Matt Pruitt
authored
Apr 14, 2021
1 parent
c9d636b
commit d00d161
Showing
23 changed files
with
419 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
# Version 0.3.0 | ||
|
||
* Add `--json` argument to all commands | ||
|
||
# Version 0.2.3 | ||
|
||
* Fixed dragonruby install from itch.io package | ||
* Fixed issue with add with empty dependencies in config | ||
* Fixed `smaug.rb` generation on Windows | ||
* Fix dragonruby install from itch.io package | ||
* Fix issue with add with empty dependencies in config | ||
* Fix `smaug.rb` generation on Windows | ||
* Add `compile_ruby` flag to enable Bytecode compilation | ||
* Automatically run `smaug install` on `smaug add` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "smaug-cli" | ||
version = "0.2.3" | ||
version = "0.3.0" | ||
authors = ["Matt Pruitt <[email protected]>"] | ||
edition = "2018" | ||
|
||
|
@@ -21,6 +21,7 @@ question = "0.2.2" | |
reqwest = { version = "0.11", features = ["blocking", "json"] } | ||
rm_rf = "0.6.1" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
stderrlog = "0.5" | ||
tinytemplate = "1.1" | ||
zip = "0.5" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
use clap::ArgMatches; | ||
use std::error::Error; | ||
use serde::Serialize; | ||
use std::fmt::Display; | ||
|
||
pub type CommandResult = Result<Box<dyn Display>, Box<dyn Error>>; | ||
pub type CommandResult = Result<Box<dyn Json>, Box<dyn Json>>; | ||
|
||
pub trait Json { | ||
fn to_json(&self) -> String; | ||
fn to_string(&self) -> String; | ||
} | ||
|
||
impl<T: Serialize + Display> Json for T { | ||
fn to_json(&self) -> String { | ||
serde_json::to_string(self).expect("Could not convert to json") | ||
} | ||
|
||
fn to_string(&self) -> String { | ||
format!("{}", self) | ||
} | ||
} | ||
|
||
pub trait Command { | ||
fn run(&self, matches: &ArgMatches) -> CommandResult; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.