Documentation
¶
Index ¶
Constants ¶
View Source
const PanicErrorCode = 8
Variables ¶
View Source
var ( Success = New(0, "succesful") Cancelled = New(0, "operation cancelled by user") NotFoundFailure = Cancelled.Next("target not found") FatalReadFailure = NotFoundFailure.Next("fatal failure during initialization") FatalWriteFailure = FatalReadFailure.Next("fatal failure during file write") WorkingDirectoryFailure = FatalWriteFailure.Next("could not get current working directory") OpenRootFailure = WorkingDirectoryFailure.Next("failed to init root directory") RootFsFailure = OpenRootFailure.Next("failed to make fs from root") CacheReadFailure = RootFsFailure.Next("failed to read cache (from " + paths.ContextsFile.String()) HydrationFailure = CacheReadFailure.Next("a hydrator failed") MenuFailure = HydrationFailure.Next("error during menu") NoTargetsFailure = MenuFailure.Next("no targets found") NoEditorFailure = NoTargetsFailure.Next("$EDITOR not set") NoDebugInfo = NoEditorFailure.Next("could not read debug info") ManFailure = New(120, "failure to generate manual pages") UnknownShellFailure = New(110, "unable to detect shell type through $SHELL") CompletionAlreadyInstalledFailure = UnknownShellFailure.Next("completion seems already installed") CompletionFailure = CompletionAlreadyInstalledFailure.Next("failed to install completion") ProfilingFailure = CompletionFailure.Next("failed to initialize profiler") )
View Source
var ( Stderr = os.Stderr Stdout = os.Stdout StyleErr = style.New(func() lipgloss.Style { return lipgloss.NewStyle().Foreground(lipgloss.Color("1")).Padding(0).Margin(0) }) StyleWarn = style.New(func() lipgloss.Style { return lipgloss.NewStyle().Foreground(lipgloss.Color("3")).Padding(0).Margin(0) }) )
View Source
var CodeMap = make(map[int]*ExitCode)
View Source
var Codes []ExitCode
View Source
var Panic = func(code *ExitCode, format string, values ...any) (any, error) { pkg := reflect.TypeOf(empty{}).PkgPath() v, err := fmt.Fprint(Stderr, StyleErr.Render(fmt.Sprintf(strings.TrimSpace(format), values...))+"\n") st := strings.Split(string(debug.Stack()), "\n") for i, l := range st { if strings.Contains(l, pkg) { st = st[i:] break } } _, _ = Warn("%s\n", strings.Join(st, "\n")) os.Exit(PanicErrorCode) return v, err }
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.