feat(cli): add ios dl command for App Store download link#259
Conversation
Add a new `ios dl` subcommand that prints the App Store URL and opens it in the user's default browser. https://claude.ai/code/session_01MRTpMAqcMQtjKKwbByPFXS
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the command-line interface by adding a new feature that allows users to directly open the App Store page for the ShellTime iOS application. This streamlines the process of finding and downloading the mobile app, improving user convenience and discoverability. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new ios dl command, which is a useful addition. The implementation is clean and follows existing patterns. I've provided a couple of suggestions to enhance maintainability by reducing code duplication and to align with command-line tool best practices for output streams.
| var IosCommand *cli.Command = &cli.Command{ | ||
| Name: "ios", | ||
| Usage: "iOS app related commands", | ||
| Subcommands: []*cli.Command{ | ||
| { | ||
| Name: "dl", | ||
| Usage: "open the ShellTime iOS app download page on the App Store", | ||
| Action: commandIosDl, | ||
| OnUsageError: func(cCtx *cli.Context, err error, isSubcommand bool) error { | ||
| color.Red.Println(err.Error()) | ||
| return nil | ||
| }, | ||
| }, | ||
| }, | ||
| OnUsageError: func(cCtx *cli.Context, err error, isSubcommand bool) error { | ||
| color.Red.Println(err.Error()) | ||
| return nil | ||
| }, | ||
| } |
There was a problem hiding this comment.
The OnUsageError handler function is duplicated for the main command and its subcommand. To improve maintainability and adhere to the Don't Repeat Yourself (DRY) principle, you can extract this logic into a shared function.
func onUsageError(cCtx *cli.Context, err error, isSubcommand bool) error {
color.Red.Println(err.Error())
return nil
}
var IosCommand *cli.Command = &cli.Command{
Name: "ios",
Usage: "iOS app related commands",
Subcommands: []*cli.Command{
{
Name: "dl",
Usage: "open the ShellTime iOS app download page on the App Store",
Action: commandIosDl,
OnUsageError: onUsageError,
},
},
OnUsageError: onUsageError,
}|
|
||
| err := browser.OpenURL(appStoreURL) | ||
| if err != nil { | ||
| fmt.Printf("Could not open browser automatically. Please visit the URL above to download.\n") |
There was a problem hiding this comment.
For better command-line-tool citizenship, error or informational messages should be printed to standard error instead of standard output. This prevents polluting stdout, which might be piped to other commands. You can use c.App.ErrWriter, which is the idiomatic way to write to stderr in urfave/cli.
fmt.Fprintf(c.App.ErrWriter, "Could not open browser automatically. Please visit the URL above to download.\n")
Summary
ios dlsubcommand that prints the App Store URL and opens it in the default browserwebcommand) usinggithub.com/pkg/browserIosCommandin main command listTest plan
shelltime ios dlprints the App Store URLhttps://claude.ai/code/session_01MRTpMAqcMQtjKKwbByPFXS