-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): integrate sails-js-cli into sails-cli #523
base: master
Are you sure you want to change the base?
Conversation
@@ -12,6 +12,26 @@ struct CargoCommands { | |||
enum SailsCommands { | |||
#[command(name = "sails", subcommand)] | |||
Sails(Commands), | |||
#[command(name = "sails-js", subcommand)] | |||
SailsJs(JsCommands), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That won't work.
Only one command sails
per cargo-sails
executable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
#[derive(Subcommand)] | ||
enum JsCommands { | ||
#[command(name = "generate-client")] | ||
GenerateClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is better to make js-client
under sails, like
cargo sails js-client service.idl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
.expect("Failed to run npx sails-js-cli"); | ||
|
||
let status = child.wait().expect("An error occured"); | ||
|
||
if !status.success() { | ||
panic!("Failed to generate JS client"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please instead of using panic
, expect
, etc., use Result to return the error s it can printed out by the program in standard way. This comment is applicable to the entire mod
} | ||
} | ||
|
||
pub fn check_app_installed(app: &str) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be pub
.unwrap_or(false) | ||
} | ||
|
||
pub fn check_node() -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be pub
Ok(()) | ||
} | ||
|
||
pub fn check_npx() -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be pub
@@ -12,6 +12,26 @@ struct CargoCommands { | |||
enum SailsCommands { | |||
#[command(name = "sails", subcommand)] | |||
Sails(Commands), | |||
#[command(name = "sails-js", subcommand)] | |||
SailsJs(JsCommands), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
#[derive(Subcommand)] | ||
enum JsCommands { | ||
#[command(name = "generate-client")] | ||
GenerateClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
No description provided.