mirror of
https://github.com/ivuorinen/gibidify.git
synced 2026-01-26 11:34:03 +00:00
* chore(ci): update go to 1.25, add permissions and envs * fix(ci): update pr-lint.yml * chore: update go, fix linting * fix: tests and linting * fix(lint): lint fixes, renovate should now pass * fix: updates, security upgrades * chore: workflow updates, lint * fix: more lint, checkmake, and other fixes * fix: more lint, convert scripts to POSIX compliant * fix: simplify codeql workflow * tests: increase test coverage, fix found issues * fix(lint): editorconfig checking, add to linters * fix(lint): shellcheck, add to linters * fix(lint): apply cr comment suggestions * fix(ci): remove step-security/harden-runner * fix(lint): remove duplication, apply cr fixes * fix(ci): tests in CI/CD pipeline * chore(lint): deduplication of strings * fix(lint): apply cr comment suggestions * fix(ci): actionlint * fix(lint): apply cr comment suggestions * chore: lint, add deps management
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
// Package main for the gibidify CLI application.
|
|
// Repository: github.com/ivuorinen/gibidify
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
"github.com/ivuorinen/gibidify/cli"
|
|
"github.com/ivuorinen/gibidify/config"
|
|
)
|
|
|
|
func main() {
|
|
// Initialize UI for error handling
|
|
ui := cli.NewUIManager()
|
|
errorFormatter := cli.NewErrorFormatter(ui)
|
|
|
|
// In production, use a background context.
|
|
if err := run(context.Background()); err != nil {
|
|
// Handle errors with better formatting and suggestions
|
|
if cli.IsUserError(err) {
|
|
errorFormatter.FormatError(err)
|
|
os.Exit(1)
|
|
}
|
|
// System errors still go to logrus for debugging
|
|
logrus.Errorf("System error: %v", err)
|
|
ui.PrintError("An unexpected error occurred. Please check the logs.")
|
|
os.Exit(2)
|
|
}
|
|
}
|
|
|
|
// Run executes the main logic of the CLI application using the provided context.
|
|
func run(ctx context.Context) error {
|
|
// Parse CLI flags
|
|
flags, err := cli.ParseFlags()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// Load configuration
|
|
config.LoadConfig()
|
|
|
|
// Create and run processor
|
|
processor := cli.NewProcessor(flags)
|
|
return processor.Process(ctx)
|
|
}
|