Skip to content
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

Update NewCLI to receive isStdinTerminal parameter #162

Merged
merged 1 commit into from
May 6, 2024

Conversation

catatsuy
Copy link
Owner

@catatsuy catatsuy commented May 6, 2024

This pull request primarily focuses on modifying the terminal check in the notify_slack command-line interface (CLI). The changes include importing the term package in main.go, removing the import in cli.go, adding a new member to the CLI struct, and updating the NewCLI function and the terminal check in Run method. The test in cli_test.go was also updated to reflect these changes.

Here are the most significant changes:

Changes in cmd/notify_slack/main.go:

  • Imported the term package and updated the NewCLI function call to include a terminal check. This change moves the terminal check from the Run method in cli.go to main.go.

Changes in internal/cli/cli.go:

  • Removed the term package import. This import is no longer needed here as the terminal check has been moved to main.go.
  • Added a new member isStdinTerminal to the CLI struct and updated the NewCLI function to accept this new member. This allows the terminal check result to be passed into the CLI struct.
  • Updated the terminal check in the Run method to use the new isStdinTerminal member of the CLI struct instead of calling term.IsTerminal. This change reflects the new design where the terminal check is done in main.go.

Changes in internal/cli/cli_test.go:

  • Updated the NewCLI function call in the test to include a boolean value for the new isStdinTerminal member. This ensures the test reflects the changes made to the CLI struct and NewCLI function.

@catatsuy catatsuy merged commit 904413f into master May 6, 2024
5 checks passed
@catatsuy catatsuy deleted the feature_have_is_term_on_cli branch May 6, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant