Feature/improve match - #16
Merged
Merged
Conversation
- Add InitToken() for on-demand OAuth flow - Add DeleteToken() for logout functionality - Add IsTokenValid() for token status checking - Add TokenExpiry() for expiry information
- Add NewAnilistOAuthWithoutInit for manual authentication - Add NewMyAnimeListOAuthWithoutInit for manual authentication - These allow CLI commands to control when OAuth flow starts
- Test IsTokenValid with no token, valid token, expired token, zero expiry - Test TokenExpiry with no token and has token - Test DeleteToken success and no token - Test InitToken already has token and context cancelled
- Add github.com/urfave/cli/v3 v3.6.1 for CLI commands
- Add cli.go with root command and backward compatibility - Add cmd_login.go for authentication - Add cmd_logout.go for token removal - Add cmd_status.go for checking auth status - Add cmd_sync.go for sync functionality - Update main.go to use RunCLI() - Add default values for global flag vars (for tests) Backward compatibility: - No command = runs sync (old behavior) - All old flags (-f, -d, --manga, --all, --verbose, --reverse-direction) work
- Add cli_test.go with tests for: - Command structure (login, logout, status, sync) - Flag presence on root and sync commands - Backward compatibility (default action is sync) - Global flag initialization - Service constants - Fix gofumpt formatting issues - Fix staticcheck warnings in cli_test.go
- Show help when unknown command or flags are provided - Add colored output for login process: * Cyan headers for service authentication * Green success messages with ✓ symbol * Blue highlighted URLs in OAuth flow * Yellow "Next steps" section - Add "Next steps" after successful login with commands to run - Fix linting issues (errcheck, gosec, gci)
- Add colorful error message when config file is not found - Show instructions to copy config.example.yaml - Highlight commands in cyan for better visibility - Add IsConfigNotFoundError helper function - Format message with sections: "To fix this" and "Alternatively"
- Don't show help for config errors (they have their own instructions) - Print config help directly to stderr - Add comprehensive config tests: - Valid config loading - Config not found error - Invalid YAML error - Environment variable overrides - Custom token path - Default token path - IsConfigNotFoundError function
- Replace unused 'ctx' parameter with '_' in cmd_logout.go and cmd_status.go - Replace fmt.Println/fmt.Printf with log.Println/log.Printf in cmd_status.go - Fix errorlint in oauth_test.go (use errors.Is instead of !=) - Remove init() function in main.go by initializing vars at declaration
- Resolve conflicts in strategies.go (keep both improvements) - Add MALIDStrategy tests from main - Keep improved logging from feature/improve-match Conflicts resolved: - strategies.go: Keep detailed logging from feature/improve-match, add MALIDStrategy from main - strategies_test.go: Append 7 new test functions from origin/main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed #10