sealos-cli 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/bin/cli.cjs +1347 -994
- package/dist/bin/cli.mjs +1347 -994
- package/dist/main.cjs +1347 -994
- package/dist/main.mjs +1347 -994
- package/package.json +1 -1
- package/src/commands/auth/index.ts +2 -2
- package/src/commands/auth/login.ts +1 -1
- package/src/commands/auth/logout.ts +21 -2
- package/src/commands/auth/whoami.ts +1 -1
- package/src/commands/database/index.ts +345 -30
- package/src/commands/devbox/index.ts +108 -24
- package/src/commands/template/index.ts +42 -14
- package/src/commands/workspace/index.ts +3 -3
- package/src/lib/auth.ts +17 -1
package/package.json
CHANGED
|
@@ -76,7 +76,7 @@ export function createAuthCommand (): Command {
|
|
|
76
76
|
authCmd
|
|
77
77
|
.command('list')
|
|
78
78
|
.description('List all workspaces')
|
|
79
|
-
.option('-o, --output <format>', 'Output format: json, table', '
|
|
79
|
+
.option('-o, --output <format>', 'Output format: json, table', 'json')
|
|
80
80
|
.action(async (options) => {
|
|
81
81
|
try {
|
|
82
82
|
const result = await listWorkspaces()
|
|
@@ -105,7 +105,7 @@ export function createAuthCommand (): Command {
|
|
|
105
105
|
.command('switch')
|
|
106
106
|
.description('Switch workspace')
|
|
107
107
|
.argument('<namespace>', 'Workspace id, uid, or team name')
|
|
108
|
-
.option('-o, --output <format>', 'Output format: json, table', '
|
|
108
|
+
.option('-o, --output <format>', 'Output format: json, table', 'json')
|
|
109
109
|
.action(async (namespace, options) => {
|
|
110
110
|
try {
|
|
111
111
|
const result = await switchWorkspace(namespace)
|
|
@@ -8,7 +8,7 @@ export function createLoginCommand (): Command {
|
|
|
8
8
|
.description('Login to Sealos Cloud')
|
|
9
9
|
.argument('[region]', 'Sealos region URL (e.g., https://usw-1.sealos.io)')
|
|
10
10
|
.option('-t, --token <token>', 'Store a regional token without OAuth device login')
|
|
11
|
-
.option('-o, --output <format>', 'Output format: json, table', '
|
|
11
|
+
.option('-o, --output <format>', 'Output format: json, table', 'json')
|
|
12
12
|
.action(async (region, options) => {
|
|
13
13
|
try {
|
|
14
14
|
const result = options.token
|
|
@@ -1,20 +1,39 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
import { checkAuth, clearAuth } from '../../lib/auth.ts'
|
|
3
|
-
import { success, warn } from '../../lib/output.ts'
|
|
3
|
+
import { outputJson, success, warn } from '../../lib/output.ts'
|
|
4
4
|
import { handleError } from '../../lib/errors.ts'
|
|
5
5
|
|
|
6
6
|
export function createLogoutCommand (): Command {
|
|
7
7
|
return new Command('logout')
|
|
8
8
|
.description('Logout from Sealos Cloud')
|
|
9
|
-
.
|
|
9
|
+
.option('-o, --output <format>', 'Output format: json, table', 'json')
|
|
10
|
+
.action(async (options) => {
|
|
10
11
|
try {
|
|
11
12
|
const status = checkAuth()
|
|
12
13
|
if (!status.authenticated) {
|
|
14
|
+
if (options.output === 'json') {
|
|
15
|
+
outputJson({
|
|
16
|
+
success: true,
|
|
17
|
+
action: 'logout',
|
|
18
|
+
authenticated: false,
|
|
19
|
+
changed: false
|
|
20
|
+
})
|
|
21
|
+
return
|
|
22
|
+
}
|
|
13
23
|
warn('You are not logged in')
|
|
14
24
|
return
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
clearAuth()
|
|
28
|
+
if (options.output === 'json') {
|
|
29
|
+
outputJson({
|
|
30
|
+
success: true,
|
|
31
|
+
action: 'logout',
|
|
32
|
+
authenticated: false,
|
|
33
|
+
changed: true
|
|
34
|
+
})
|
|
35
|
+
return
|
|
36
|
+
}
|
|
18
37
|
success('Logged out from Sealos Cloud')
|
|
19
38
|
} catch (error) {
|
|
20
39
|
handleError(error)
|
|
@@ -6,7 +6,7 @@ import { handleError, AuthError } from '../../lib/errors.ts'
|
|
|
6
6
|
export function createWhoamiCommand (): Command {
|
|
7
7
|
return new Command('whoami')
|
|
8
8
|
.description('Display current user information')
|
|
9
|
-
.option('-o, --output <format>', 'Output format: json, table', '
|
|
9
|
+
.option('-o, --output <format>', 'Output format: json, table', 'json')
|
|
10
10
|
.action(async (options) => {
|
|
11
11
|
try {
|
|
12
12
|
const authInfo = getAuthInfo()
|