-
Notifications
You must be signed in to change notification settings - Fork 487
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
Add silent flag to the cli command to supress game logs (#46) #82
Conversation
Codecov Report
@@ Coverage Diff @@
## master #82 +/- ##
==========================================
- Coverage 91.13% 91.05% -0.08%
==========================================
Files 81 81
Lines 1049 1051 +2
Branches 168 169 +1
==========================================
+ Hits 956 957 +1
Misses 77 77
- Partials 16 17 +1
Continue to review full report at Codecov.
|
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.
@xaviserrag Thank you for your interest in the project and for this PR! This is gonna be useful.
Some comments: go ahead and use -s
for the short version of --silent
as I'm working on a PR to change the --skip
option (I have the feeling --silent
is gonna be more used than --skip
). Once I merge that PR you'll have to update this one but you can start working in the changes if you like.
packages/warriorjs-cli/src/Game.js
Outdated
@@ -31,13 +31,21 @@ class Game { | |||
* @param {string} runDirectoryPath The directory under which to run the game. | |||
* @param {number} practiceLevel The level to practice. | |||
* @param {boolean} skipInput Whether to skip user input or not. | |||
* @param {boolean} silentGameplay Whether to skip displaying game logs or not. |
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.
@xaviserrag What do you think of silencePlay
instead of silentGameplay
?
packages/warriorjs-cli/src/cli.js
Outdated
@@ -7,8 +7,8 @@ import parseArgs from './parseArgs'; | |||
* @param {string[]} args The command line arguments. | |||
*/ | |||
async function run(args) { | |||
const { directory, level, skip, time } = parseArgs(args); | |||
const game = new Game(directory, level, skip, time); | |||
const { directory, level, skip, time, silent } = parseArgs(args); |
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.
Let's keep the alphabetical order here 👆
@@ -35,6 +35,11 @@ function parseArgs(args) { | |||
describe: 'Skip user input', | |||
type: 'boolean', | |||
}, | |||
m: { |
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.
Let's use s
here, as per my general comment.
@@ -35,6 +35,11 @@ function parseArgs(args) { | |||
describe: 'Skip user input', | |||
type: 'boolean', | |||
}, | |||
m: { | |||
alias: 'silent', | |||
describe: 'Skip displaying game logs', |
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.
What we are suppressing is the play log, what do you think we change this to "Suppress play log"?
@xaviserrag Also, if you can add tests to this to at least preserve the coverage, that'd be awesome! |
@xaviserrag Just writing to let you know that |
Sounds good! Will go through the changes soon! |
@xaviserrag I just noticed that the documentation needs to be updated as well (it lists the options in alphabetical order). |
38c3815
to
1ab31c6
Compare
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.
Thanks for the changes!
After merging #144, I took the liberty to commit to your branch and undo the changes to the package.json
files. Then I added a tiny commit with some cosmetic changes.
Thanks! |
Modified the CLI project to accept a --silent value so the gameplay skips the play logs.
Had to use -m (mute) for the short version of the command since -s was already used, open to suggestions on using other options.
Saw this project yesterday and I loved it, keep up the good work! ;)
Closes #46