Request for Feedback: CLI output format #136
Replies: 5 comments 4 replies
-
** Note this is all my opinion, I'm editing out all my subjective qualifiers to be more concise ** |
Beta Was this translation helpful? Give feedback.
-
Thanks to everyone for considering this 😄 here's my 2c:
|
Beta Was this translation helpful? Give feedback.
-
My own opinions:
I think stdout should be the default. More UNIX-friendly, and you can easily append to a file in bash for example
IMO it would make sense to implement this as separate formatters. Have one formatter option for the legacy Go struct output, have a new formatter option for human-readable logs, have another formatter for JSONL streams, etc. Better to give people the option than to try to fit every shape into one implementation. This is how popular test suite packages do it too.
No opinion, but any way it's done, please prefer backwards compatibility.
I would say no, trying to keep that in sync will be a chore, and probably not worth it because the engine already has different internals than the public-facing Battlesnake API.
No, I would say don't remove existing behavior. You could make it an option? |
Beta Was this translation helpful? Give feedback.
-
My turn!
I like stdout, as xtagon said is more UNIXy which I like in my clis. It's also more convenient for scripting where I might want to pipe the results to another process. I've done this with the current CLI output to manually grab the winner name from the text, for example.
Agree with xtagon again! Having different formatters would be my preference. For bonus points it would be really cool to be able to specify a 'channel' for a formatter. Imagining a CLI maybe its something like:
Yup!
Not neccesary
Would prefer matching the output as much as possible but as others have said its not challenging to convert between formats.
Would like to keep it! I think in a perfect world the prod win/lose detection would be part of this repo, or available for this repo to use in some way. But understand that may not be possible/reasonable neccesarily |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback everyone - this is great 😄 Summarizing what's been said so far: CLI output to stdout vs. file
Output format
Matching the Battlesnake API
Removing winner detection
I've highlighted the points above that I think require changes in the PR before merging. @simonamdev, do you have time and interest to keep working on this? I'm happy to either keep reviewing or take it over - let me know! |
Beta Was this translation helpful? Give feedback.
-
Although the rules CLI allows running games locally, the output isn't easy to parse and is mostly designed for humans. A standard way to run a local game and retrieve the results programmatically has been a common feature request.
@simonamdev has a PR that adds an option to output the game state and results to a file in JSON lines (BattlesnakeOfficial/rules#56). We'd like to get some feedback from the community about the format and implementation details, to ensure we're covering most people's needs.
A couple of questions as a starting point:
Beta Was this translation helpful? Give feedback.
All reactions