Skip to content

Feature/improve match - #16

Merged
bigspawn merged 13 commits into
mainfrom
feature/improve-match
Jan 7, 2026
Merged

Feature/improve match#16
bigspawn merged 13 commits into
mainfrom
feature/improve-match

Conversation

@bigspawn

@bigspawn bigspawn commented Jan 7, 2026

Copy link
Copy Markdown
Owner

Fixed #10

- 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
@bigspawn
bigspawn merged commit 061732a into main Jan 7, 2026
6 checks passed
@bigspawn
bigspawn deleted the feature/improve-match branch January 7, 2026 18:58
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.

Target not found

1 participant