Skip to content

Commit 930ff59

Browse files
authored
Merge pull request #587 from rusq/wsp-new
Shortcut to workspace auth wizard
2 parents cc419bd + 8c682e2 commit 930ff59

File tree

7 files changed

+44
-23
lines changed

7 files changed

+44
-23
lines changed

cmd/slackdump/internal/workspace/del.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var (
1919
//go:embed assets/del.md
2020
var delMD string
2121

22-
var CmdWspDel = &base.Command{
22+
var cmdWspDel = &base.Command{
2323
UsageLine: baseCommand + " del [flags]",
2424
Short: "deletes the saved workspace credentials",
2525
Long: delMD,
@@ -29,11 +29,11 @@ var CmdWspDel = &base.Command{
2929
}
3030

3131
func init() {
32-
CmdWspDel.Run = runWspDel
32+
cmdWspDel.Run = runWspDel
3333
}
3434

3535
var (
36-
delAll = CmdWspDel.Flag.Bool("a", false, "delete all workspaces")
36+
delAll = cmdWspDel.Flag.Bool("a", false, "delete all workspaces")
3737
)
3838

3939
func runWspDel(ctx context.Context, cmd *base.Command, args []string) error {

cmd/slackdump/internal/workspace/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
//go:embed assets/import.md
1414
var importMd string
1515

16-
var CmdImport = &base.Command{
16+
var cmdWspImport = &base.Command{
1717
UsageLine: baseCommand + " import [flags] filename",
1818
Short: "import credentials from .env or secrets.txt file",
1919
Long: importMd,

cmd/slackdump/internal/workspace/list.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
//go:embed assets/list.md
2424
var listMd string
2525

26-
var CmdWspList = &base.Command{
26+
var cmdWspList = &base.Command{
2727
UsageLine: baseCommand + " list [flags]",
2828
Short: "list saved authentication information",
2929
Long: listMd,
@@ -32,12 +32,12 @@ var CmdWspList = &base.Command{
3232
}
3333

3434
var (
35-
bare = CmdWspList.Flag.Bool("b", false, "bare output format (just names)")
36-
all = CmdWspList.Flag.Bool("a", false, "all information, including user")
35+
bare = cmdWspList.Flag.Bool("b", false, "bare output format (just names)")
36+
all = cmdWspList.Flag.Bool("a", false, "all information, including user")
3737
)
3838

3939
func init() {
40-
CmdWspList.Run = runList
40+
cmdWspList.Run = runList
4141
}
4242

4343
func runList(ctx context.Context, cmd *base.Command, args []string) error {

cmd/slackdump/internal/workspace/new.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
//go:embed assets/new.md
2020
var newMD string
2121

22-
var CmdWspNew = &base.Command{
22+
var cmdWspNew = &base.Command{
2323
UsageLine: baseCommand + " new [flags] <name>",
2424
Short: "authenticate in a Slack Workspace",
2525
Long: newMD,
@@ -29,9 +29,9 @@ var CmdWspNew = &base.Command{
2929
}
3030

3131
func init() {
32-
wspcfg.SetWspFlags(&CmdWspNew.Flag)
32+
wspcfg.SetWspFlags(&cmdWspNew.Flag)
3333

34-
CmdWspNew.Run = runWspNew
34+
cmdWspNew.Run = runWspNew
3535
}
3636

3737
// runWspNew authenticates in the new workspace.

cmd/slackdump/internal/workspace/select.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/rusq/slackdump/v3/internal/cache"
1010
)
1111

12-
var CmdWspSelect = &base.Command{
12+
var cmdWspSelect = &base.Command{
1313
UsageLine: baseCommand + " select [flags]",
1414
Short: "choose a previously saved workspace",
1515
Long: `
@@ -32,7 +32,7 @@ To get the full list of authenticated workspaces, run:
3232
}
3333

3434
func init() {
35-
CmdWspSelect.Run = runSelect
35+
cmdWspSelect.Run = runSelect
3636
}
3737

3838
func runSelect(ctx context.Context, cmd *base.Command, args []string) error {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package workspace
2+
3+
import (
4+
"github.com/rusq/slackdump/v3/cmd/slackdump/internal/cfg"
5+
"github.com/rusq/slackdump/v3/cmd/slackdump/internal/golang/base"
6+
"github.com/rusq/slackdump/v3/cmd/slackdump/internal/workspace/workspaceui"
7+
)
8+
9+
var cmdWspWiz = &base.Command{
10+
Run: workspaceui.WorkspaceNew,
11+
UsageLine: baseCommand + " wiz [flags]",
12+
Short: "starts new workspace wizard",
13+
Long: `# Workspace Wizard
14+
Use this command to start the Workspace creation wizard.
15+
16+
The behaviour is the same as if one chooses Slackdump Wizard ==> Workspace ==> New.
17+
`,
18+
FlagMask: cfg.OmitAll,
19+
PrintFlags: false,
20+
RequireAuth: false,
21+
HideWizard: true,
22+
}

cmd/slackdump/internal/workspace/workspace.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,21 @@ an environment file.
4040
4141
To learn more about different login options, run:
4242
43-
slackdump help workspace
43+
slackdump workspace help <sub-command>
4444
4545
Workspaces are stored on this device in the system Cache directory, which is
4646
automatically detected to be:
47+
4748
` + cfg.CacheDir() + `
4849
`,
49-
CustomFlags: false,
50-
FlagMask: flagmask,
51-
PrintFlags: false,
52-
RequireAuth: false,
50+
FlagMask: flagmask,
5351
Commands: []*base.Command{
54-
CmdWspNew,
55-
CmdImport,
56-
CmdWspList,
57-
CmdWspSelect,
58-
CmdWspDel,
52+
cmdWspNew,
53+
cmdWspImport,
54+
cmdWspList,
55+
cmdWspSelect,
56+
cmdWspDel,
57+
cmdWspWiz,
5958
},
6059
}
6160

0 commit comments

Comments
 (0)