mirror of
https://github.com/charmbracelet/gum.git
synced 2024-08-17 02:00:46 +03:00
refactor: exit package
This commit is contained in:
parent
6538d726d1
commit
d324abeab5
@ -8,6 +8,7 @@ import (
|
||||
"github.com/alecthomas/kong"
|
||||
"github.com/charmbracelet/bubbles/textinput"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/gum/internal/exit"
|
||||
"github.com/charmbracelet/gum/internal/files"
|
||||
"github.com/charmbracelet/gum/internal/stdin"
|
||||
"github.com/charmbracelet/gum/style"
|
||||
@ -45,7 +46,7 @@ func (o Options) Run() error {
|
||||
m := tm.(model)
|
||||
|
||||
if m.aborted {
|
||||
return fmt.Errorf("filter aborted")
|
||||
os.Exit(exit.Aborted)
|
||||
}
|
||||
if len(m.matches) > m.selected && m.selected >= 0 {
|
||||
fmt.Println(m.matches[m.selected].Str)
|
||||
|
4
internal/exit/exit.go
Normal file
4
internal/exit/exit.go
Normal file
@ -0,0 +1,4 @@
|
||||
package exit
|
||||
|
||||
// Aborted is the exit code for aborted commands.
|
||||
const Aborted = 130
|
Loading…
Reference in New Issue
Block a user