-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
112 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package workspaceui | ||
|
||
import ( | ||
"context" | ||
|
||
tea "github.com/charmbracelet/bubbletea" | ||
|
||
"github.com/rusq/slackdump/v3/cmd/slackdump/internal/golang/base" | ||
"github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui/bubbles/menu" | ||
) | ||
|
||
type wizModel struct { | ||
m *menu.Model | ||
} | ||
|
||
func WorkspaceNew(ctx context.Context, _ *base.Command, _ []string) error { | ||
items := []menu.Item{ | ||
{ | ||
ID: "ezlogin", | ||
Name: "Login in Browser", | ||
Help: "Login to Slack in your browser", | ||
}, | ||
{ | ||
ID: "token", | ||
Name: "Token/Cookie", | ||
Help: "Enter token and cookie that you grabbed from the browser", | ||
}, | ||
{ | ||
ID: "secrets", | ||
Name: "From file with secrets", | ||
Help: "Read from secrets.txt or .env file", | ||
}, | ||
{ | ||
Separator: true, | ||
}, | ||
{ | ||
ID: "exit", | ||
Name: "Exit", | ||
Help: "Exit to main menu", | ||
}, | ||
} | ||
|
||
m := menu.New("New Workspace", items, true) | ||
|
||
if _, err := tea.NewProgram(&wizModel{m: m}, tea.WithContext(ctx)).Run(); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (m *wizModel) Init() tea.Cmd { | ||
return m.m.Init() | ||
} | ||
|
||
func (m *wizModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | ||
return m.m.Update(msg) | ||
} | ||
|
||
func (m *wizModel) View() string { | ||
return m.m.View() | ||
} |