@myapihq/cli 1.0.10 → 1.0.12
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/dist/commands/domain.d.ts +8 -5
- package/dist/commands/domain.js +74 -22
- package/dist/commands/org.js +5 -5
- package/package.json +1 -1
- package/src/commands/domain.ts +63 -22
- package/src/commands/org.ts +5 -5
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export declare function check(
|
|
2
|
-
export declare function register(
|
|
3
|
-
export declare function importDomain(
|
|
4
|
-
export declare function list(
|
|
5
|
-
export declare function
|
|
1
|
+
export declare function check(domain: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
2
|
+
export declare function register(domain: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
3
|
+
export declare function importDomain(domain: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
4
|
+
export declare function list(flags: Record<string, string | boolean>): Promise<void>;
|
|
5
|
+
export declare function assign(domain: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
6
|
+
export declare function unassign(domain: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
7
|
+
export declare function settings(domain: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
8
|
+
export declare function updateSettings(domain: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
6
9
|
export declare function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>): Promise<void>;
|
package/dist/commands/domain.js
CHANGED
|
@@ -4,14 +4,18 @@ exports.check = check;
|
|
|
4
4
|
exports.register = register;
|
|
5
5
|
exports.importDomain = importDomain;
|
|
6
6
|
exports.list = list;
|
|
7
|
+
exports.assign = assign;
|
|
8
|
+
exports.unassign = unassign;
|
|
7
9
|
exports.settings = settings;
|
|
10
|
+
exports.updateSettings = updateSettings;
|
|
8
11
|
exports.run = run;
|
|
9
12
|
const sdk_1 = require("@myapihq/sdk");
|
|
10
13
|
const config_js_1 = require("../config.js");
|
|
11
14
|
const output_js_1 = require("../output.js");
|
|
12
|
-
async function check(
|
|
15
|
+
async function check(domain, flags) {
|
|
16
|
+
const orgId = flags.org;
|
|
13
17
|
if (!orgId || !domain)
|
|
14
|
-
(0, output_js_1.error)("Missing
|
|
18
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain check <domain> --org <id>");
|
|
15
19
|
const config = (0, config_js_1.requireConfig)();
|
|
16
20
|
const res = await sdk_1.domain.checkDomain(config.api_key, orgId, domain);
|
|
17
21
|
if (res.available) {
|
|
@@ -21,19 +25,21 @@ async function check(orgId, domain, flags) {
|
|
|
21
25
|
(0, output_js_1.info)(`Not available ✗`);
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
|
-
async function register(
|
|
28
|
+
async function register(domain, flags) {
|
|
29
|
+
const orgId = flags.org;
|
|
25
30
|
if (!orgId || !domain)
|
|
26
|
-
(0, output_js_1.error)("Missing
|
|
31
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]");
|
|
27
32
|
const years = parseInt(flags.years) || 1;
|
|
28
33
|
const config = (0, config_js_1.requireConfig)();
|
|
29
34
|
const res = await sdk_1.domain.registerDomain(config.api_key, orgId, domain, years);
|
|
30
35
|
(0, output_js_1.success)(`Registered ${domain}!\n${JSON.stringify(res, null, 2)}`);
|
|
31
36
|
}
|
|
32
|
-
async function importDomain(
|
|
37
|
+
async function importDomain(domain, flags) {
|
|
38
|
+
const orgId = flags.org;
|
|
33
39
|
if (!orgId || !domain)
|
|
34
|
-
(0, output_js_1.error)("Missing
|
|
40
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
|
|
35
41
|
if (!flags['namecheap-user'] || !flags['namecheap-key']) {
|
|
36
|
-
(0, output_js_1.error)("Missing --namecheap-user
|
|
42
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
|
|
37
43
|
}
|
|
38
44
|
const config = (0, config_js_1.requireConfig)();
|
|
39
45
|
await sdk_1.domain.importDomain(config.api_key, orgId, {
|
|
@@ -43,49 +49,95 @@ async function importDomain(orgId, domain, flags) {
|
|
|
43
49
|
});
|
|
44
50
|
(0, output_js_1.success)(`Imported ${domain}`);
|
|
45
51
|
}
|
|
46
|
-
async function list(
|
|
52
|
+
async function list(flags) {
|
|
53
|
+
const orgId = flags.org;
|
|
47
54
|
if (!orgId)
|
|
48
|
-
(0, output_js_1.error)("Missing
|
|
55
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain list --org <id> [--filter=all|unassigned|org]");
|
|
49
56
|
const config = (0, config_js_1.requireConfig)();
|
|
50
57
|
const filter = flags.filter;
|
|
51
58
|
const domains = await sdk_1.domain.listDomains(config.api_key, orgId, filter);
|
|
52
59
|
(0, output_js_1.printTable)(domains);
|
|
53
60
|
}
|
|
54
|
-
async function
|
|
61
|
+
async function assign(domain, flags) {
|
|
62
|
+
const orgId = flags.org;
|
|
63
|
+
const targetOrgId = flags.target;
|
|
64
|
+
if (!orgId || !domain || !targetOrgId)
|
|
65
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id> --target <target_org_id>");
|
|
66
|
+
const config = (0, config_js_1.requireConfig)();
|
|
67
|
+
const res = await sdk_1.domain.assignDomain(config.api_key, orgId, domain, targetOrgId);
|
|
68
|
+
(0, output_js_1.success)(`Assigned ${domain} to org ${targetOrgId}`);
|
|
69
|
+
}
|
|
70
|
+
async function unassign(domain, flags) {
|
|
71
|
+
const orgId = flags.org;
|
|
72
|
+
if (!orgId || !domain)
|
|
73
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>");
|
|
74
|
+
const config = (0, config_js_1.requireConfig)();
|
|
75
|
+
const res = await sdk_1.domain.unassignDomain(config.api_key, orgId, domain);
|
|
76
|
+
(0, output_js_1.success)(`Unassigned ${domain} from org ${orgId}`);
|
|
77
|
+
}
|
|
78
|
+
async function settings(domain, flags) {
|
|
79
|
+
const orgId = flags.org;
|
|
55
80
|
if (!orgId || !domain)
|
|
56
|
-
(0, output_js_1.error)("Missing
|
|
81
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain settings <domain> --org <id>");
|
|
57
82
|
const config = (0, config_js_1.requireConfig)();
|
|
58
83
|
const res = await sdk_1.domain.getDomainSettings(config.api_key, orgId, domain);
|
|
59
84
|
(0, output_js_1.printJson)(res);
|
|
60
85
|
}
|
|
86
|
+
async function updateSettings(domain, flags) {
|
|
87
|
+
const orgId = flags.org;
|
|
88
|
+
if (!orgId || !domain)
|
|
89
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain update-settings <domain> --org <id> [--security=...] [--browser-check=...] [--purge-cache]");
|
|
90
|
+
const config = (0, config_js_1.requireConfig)();
|
|
91
|
+
const payload = {};
|
|
92
|
+
if (flags.security)
|
|
93
|
+
payload.security_level = flags.security;
|
|
94
|
+
if (flags['browser-check'])
|
|
95
|
+
payload.browser_check = flags['browser-check'];
|
|
96
|
+
if (flags['purge-cache'])
|
|
97
|
+
payload.purge_cache = true;
|
|
98
|
+
const res = await sdk_1.domain.updateDomainSettings(config.api_key, orgId, domain, payload);
|
|
99
|
+
(0, output_js_1.success)(`Updated settings for ${domain}!\n${JSON.stringify(res, null, 2)}`);
|
|
100
|
+
}
|
|
61
101
|
async function run(subcommand, args, flags) {
|
|
62
102
|
if (!subcommand || (flags.help && !subcommand)) {
|
|
63
|
-
(0, output_js_1.info)('Usage: myapi domain <subcommand>\n\nSubcommands:\n list
|
|
103
|
+
(0, output_js_1.info)('Usage: myapi domain <subcommand>\n\nSubcommands:\n list List domains\n check Check domain availability\n register Register a domain\n import Import an existing domain\n assign Assign domain to org\n unassign Unassign domain from its current org\n settings Get domain settings\n update-settings Update domain settings\n\nNote: All domain commands require the --org <id> flag.');
|
|
64
104
|
return;
|
|
65
105
|
}
|
|
66
106
|
if (flags.help) {
|
|
67
107
|
if (subcommand === 'list')
|
|
68
|
-
(0, output_js_1.info)('Usage: myapi domain list <
|
|
108
|
+
(0, output_js_1.info)('Usage: myapi domain list --org <id> [--filter=all|unassigned|org]\n\nLists all registered domains in your account.\n --filter=all Lists all domains owned by the account.\n --filter=unassigned Lists domains not assigned to an org.\n --filter=org (Default) Lists domains assigned to the current org.');
|
|
69
109
|
else if (subcommand === 'check')
|
|
70
|
-
(0, output_js_1.info)('Usage: myapi domain check <
|
|
110
|
+
(0, output_js_1.info)('Usage: myapi domain check <domain> --org <id>\n\nChecks if a domain name is available for registration.');
|
|
71
111
|
else if (subcommand === 'register')
|
|
72
|
-
(0, output_js_1.info)('Usage: myapi domain register <
|
|
112
|
+
(0, output_js_1.info)('Usage: myapi domain register <domain> --org <id> [--years <num>]\n\nRegisters a new domain name.');
|
|
73
113
|
else if (subcommand === 'import')
|
|
74
|
-
(0, output_js_1.info)('Usage: myapi domain import <
|
|
114
|
+
(0, output_js_1.info)('Usage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>\n\nImports an existing domain from Namecheap.');
|
|
115
|
+
else if (subcommand === 'assign')
|
|
116
|
+
(0, output_js_1.info)('Usage: myapi domain assign <domain> --org <id> --target <target_org_id>\n\nAssigns a domain to a different organization.');
|
|
117
|
+
else if (subcommand === 'unassign')
|
|
118
|
+
(0, output_js_1.info)('Usage: myapi domain unassign <domain> --org <id>\n\nUnassigns a domain from its current organization.');
|
|
75
119
|
else if (subcommand === 'settings')
|
|
76
|
-
(0, output_js_1.info)('Usage: myapi domain settings <
|
|
120
|
+
(0, output_js_1.info)('Usage: myapi domain settings <domain> --org <id>\n\nGets the DNS settings and configuration for a domain.');
|
|
121
|
+
else if (subcommand === 'update-settings')
|
|
122
|
+
(0, output_js_1.info)('Usage: myapi domain update-settings <domain> --org <id> [--security=essentially_off|medium|high|under_attack] [--browser-check=on|off] [--purge-cache]\n\nUpdates edge settings for a domain.');
|
|
77
123
|
return;
|
|
78
124
|
}
|
|
79
125
|
if (subcommand === 'list')
|
|
80
|
-
await list(
|
|
126
|
+
await list(flags);
|
|
81
127
|
else if (subcommand === 'check')
|
|
82
|
-
await check(args[0],
|
|
128
|
+
await check(args[0], flags);
|
|
83
129
|
else if (subcommand === 'register')
|
|
84
|
-
await register(args[0],
|
|
130
|
+
await register(args[0], flags);
|
|
85
131
|
else if (subcommand === 'import')
|
|
86
|
-
await importDomain(args[0],
|
|
132
|
+
await importDomain(args[0], flags);
|
|
133
|
+
else if (subcommand === 'assign')
|
|
134
|
+
await assign(args[0], flags);
|
|
135
|
+
else if (subcommand === 'unassign')
|
|
136
|
+
await unassign(args[0], flags);
|
|
87
137
|
else if (subcommand === 'settings')
|
|
88
|
-
await settings(args[0],
|
|
138
|
+
await settings(args[0], flags);
|
|
139
|
+
else if (subcommand === 'update-settings')
|
|
140
|
+
await updateSettings(args[0], flags);
|
|
89
141
|
else
|
|
90
142
|
(0, output_js_1.error)(`Unknown subcommand: ${subcommand}. Run "myapi domain --help" for a list of valid subcommands.`);
|
|
91
143
|
}
|
package/dist/commands/org.js
CHANGED
|
@@ -68,13 +68,13 @@ async function del(id, flags) {
|
|
|
68
68
|
}
|
|
69
69
|
async function importOrg(args, flags) {
|
|
70
70
|
if (flags.help) {
|
|
71
|
-
(0, output_js_1.info)('Usage: myapi org import <
|
|
71
|
+
(0, output_js_1.info)('Usage: myapi org import <domain> --org <id>\n\nAutomatically extracts brand info from an existing website and updates the organization.\n\nNote: You must create a placeholder organization first using `myapi org create` to get an org_id.');
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
if (!
|
|
77
|
-
(0, output_js_1.error)("Missing arguments
|
|
74
|
+
const domain = args[0];
|
|
75
|
+
const orgId = flags.org;
|
|
76
|
+
if (!domain || !orgId) {
|
|
77
|
+
(0, output_js_1.error)("Missing required arguments.\nUsage: myapi org import <domain> --org <id>");
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
const config = (0, config_js_1.requireConfig)();
|
package/package.json
CHANGED
package/src/commands/domain.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { domain as sdkDomain } from '@myapihq/sdk';
|
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { success, error, info, printTable, printJson } from '../output.js';
|
|
4
4
|
|
|
5
|
-
export async function check(
|
|
6
|
-
|
|
5
|
+
export async function check(domain: string, flags: Record<string, string | boolean>) {
|
|
6
|
+
const orgId = flags.org as string;
|
|
7
|
+
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain check <domain> --org <id>");
|
|
7
8
|
const config = requireConfig();
|
|
8
9
|
const res = await sdkDomain.checkDomain(config.api_key, orgId, domain);
|
|
9
10
|
if (res.available) {
|
|
@@ -13,18 +14,20 @@ export async function check(orgId: string, domain: string, flags: Record<string,
|
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export async function register(
|
|
17
|
-
|
|
17
|
+
export async function register(domain: string, flags: Record<string, string | boolean>) {
|
|
18
|
+
const orgId = flags.org as string;
|
|
19
|
+
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]");
|
|
18
20
|
const years = parseInt(flags.years as string) || 1;
|
|
19
21
|
const config = requireConfig();
|
|
20
22
|
const res = await sdkDomain.registerDomain(config.api_key, orgId, domain, years);
|
|
21
23
|
success(`Registered ${domain}!\n${JSON.stringify(res, null, 2)}`);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
export async function importDomain(
|
|
25
|
-
|
|
26
|
+
export async function importDomain(domain: string, flags: Record<string, string | boolean>) {
|
|
27
|
+
const orgId = flags.org as string;
|
|
28
|
+
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
|
|
26
29
|
if (!flags['namecheap-user'] || !flags['namecheap-key']) {
|
|
27
|
-
error("Missing --namecheap-user
|
|
30
|
+
error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
|
|
28
31
|
}
|
|
29
32
|
const config = requireConfig();
|
|
30
33
|
await sdkDomain.importDomain(config.api_key, orgId, {
|
|
@@ -35,40 +38,78 @@ export async function importDomain(orgId: string, domain: string, flags: Record<
|
|
|
35
38
|
success(`Imported ${domain}`);
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
export async function list(
|
|
39
|
-
|
|
41
|
+
export async function list(flags: Record<string, string | boolean>) {
|
|
42
|
+
const orgId = flags.org as string;
|
|
43
|
+
if (!orgId) error("Missing required arguments.\nUsage: myapi domain list --org <id> [--filter=all|unassigned|org]");
|
|
40
44
|
const config = requireConfig();
|
|
41
45
|
const filter = flags.filter as 'all' | 'unassigned' | 'org' | undefined;
|
|
42
46
|
const domains = await sdkDomain.listDomains(config.api_key, orgId, filter);
|
|
43
47
|
printTable(domains as unknown as Record<string, unknown>[]);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
export async function
|
|
47
|
-
|
|
50
|
+
export async function assign(domain: string, flags: Record<string, string | boolean>) {
|
|
51
|
+
const orgId = flags.org as string;
|
|
52
|
+
const targetOrgId = flags.target as string;
|
|
53
|
+
if (!orgId || !domain || !targetOrgId) error("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id> --target <target_org_id>");
|
|
54
|
+
const config = requireConfig();
|
|
55
|
+
const res = await sdkDomain.assignDomain(config.api_key, orgId, domain, targetOrgId);
|
|
56
|
+
success(`Assigned ${domain} to org ${targetOrgId}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function unassign(domain: string, flags: Record<string, string | boolean>) {
|
|
60
|
+
const orgId = flags.org as string;
|
|
61
|
+
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>");
|
|
62
|
+
const config = requireConfig();
|
|
63
|
+
const res = await sdkDomain.unassignDomain(config.api_key, orgId, domain);
|
|
64
|
+
success(`Unassigned ${domain} from org ${orgId}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function settings(domain: string, flags: Record<string, string | boolean>) {
|
|
68
|
+
const orgId = flags.org as string;
|
|
69
|
+
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain settings <domain> --org <id>");
|
|
48
70
|
const config = requireConfig();
|
|
49
71
|
const res = await sdkDomain.getDomainSettings(config.api_key, orgId, domain);
|
|
50
72
|
printJson(res);
|
|
51
73
|
}
|
|
52
74
|
|
|
75
|
+
export async function updateSettings(domain: string, flags: Record<string, string | boolean>) {
|
|
76
|
+
const orgId = flags.org as string;
|
|
77
|
+
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain update-settings <domain> --org <id> [--security=...] [--browser-check=...] [--purge-cache]");
|
|
78
|
+
const config = requireConfig();
|
|
79
|
+
const payload: any = {};
|
|
80
|
+
if (flags.security) payload.security_level = flags.security as string;
|
|
81
|
+
if (flags['browser-check']) payload.browser_check = flags['browser-check'] as string;
|
|
82
|
+
if (flags['purge-cache']) payload.purge_cache = true;
|
|
83
|
+
|
|
84
|
+
const res = await sdkDomain.updateDomainSettings(config.api_key, orgId, domain, payload);
|
|
85
|
+
success(`Updated settings for ${domain}!\n${JSON.stringify(res, null, 2)}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
53
88
|
export async function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>) {
|
|
54
89
|
if (!subcommand || (flags.help && !subcommand)) {
|
|
55
|
-
info('Usage: myapi domain <subcommand>\n\nSubcommands:\n list
|
|
90
|
+
info('Usage: myapi domain <subcommand>\n\nSubcommands:\n list List domains\n check Check domain availability\n register Register a domain\n import Import an existing domain\n assign Assign domain to org\n unassign Unassign domain from its current org\n settings Get domain settings\n update-settings Update domain settings\n\nNote: All domain commands require the --org <id> flag.');
|
|
56
91
|
return;
|
|
57
92
|
}
|
|
58
93
|
|
|
59
94
|
if (flags.help) {
|
|
60
|
-
if (subcommand === 'list') info('Usage: myapi domain list <
|
|
61
|
-
else if (subcommand === 'check') info('Usage: myapi domain check <
|
|
62
|
-
else if (subcommand === 'register') info('Usage: myapi domain register <
|
|
63
|
-
else if (subcommand === 'import') info('Usage: myapi domain import <
|
|
64
|
-
else if (subcommand === '
|
|
95
|
+
if (subcommand === 'list') info('Usage: myapi domain list --org <id> [--filter=all|unassigned|org]\n\nLists all registered domains in your account.\n --filter=all Lists all domains owned by the account.\n --filter=unassigned Lists domains not assigned to an org.\n --filter=org (Default) Lists domains assigned to the current org.');
|
|
96
|
+
else if (subcommand === 'check') info('Usage: myapi domain check <domain> --org <id>\n\nChecks if a domain name is available for registration.');
|
|
97
|
+
else if (subcommand === 'register') info('Usage: myapi domain register <domain> --org <id> [--years <num>]\n\nRegisters a new domain name.');
|
|
98
|
+
else if (subcommand === 'import') info('Usage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>\n\nImports an existing domain from Namecheap.');
|
|
99
|
+
else if (subcommand === 'assign') info('Usage: myapi domain assign <domain> --org <id> --target <target_org_id>\n\nAssigns a domain to a different organization.');
|
|
100
|
+
else if (subcommand === 'unassign') info('Usage: myapi domain unassign <domain> --org <id>\n\nUnassigns a domain from its current organization.');
|
|
101
|
+
else if (subcommand === 'settings') info('Usage: myapi domain settings <domain> --org <id>\n\nGets the DNS settings and configuration for a domain.');
|
|
102
|
+
else if (subcommand === 'update-settings') info('Usage: myapi domain update-settings <domain> --org <id> [--security=essentially_off|medium|high|under_attack] [--browser-check=on|off] [--purge-cache]\n\nUpdates edge settings for a domain.');
|
|
65
103
|
return;
|
|
66
104
|
}
|
|
67
105
|
|
|
68
|
-
if (subcommand === 'list') await list(
|
|
69
|
-
else if (subcommand === 'check') await check(args[0],
|
|
70
|
-
else if (subcommand === 'register') await register(args[0],
|
|
71
|
-
else if (subcommand === 'import') await importDomain(args[0],
|
|
72
|
-
else if (subcommand === '
|
|
106
|
+
if (subcommand === 'list') await list(flags);
|
|
107
|
+
else if (subcommand === 'check') await check(args[0], flags);
|
|
108
|
+
else if (subcommand === 'register') await register(args[0], flags);
|
|
109
|
+
else if (subcommand === 'import') await importDomain(args[0], flags);
|
|
110
|
+
else if (subcommand === 'assign') await assign(args[0], flags);
|
|
111
|
+
else if (subcommand === 'unassign') await unassign(args[0], flags);
|
|
112
|
+
else if (subcommand === 'settings') await settings(args[0], flags);
|
|
113
|
+
else if (subcommand === 'update-settings') await updateSettings(args[0], flags);
|
|
73
114
|
else error(`Unknown subcommand: ${subcommand}. Run "myapi domain --help" for a list of valid subcommands.`);
|
|
74
115
|
}
|
package/src/commands/org.ts
CHANGED
|
@@ -63,14 +63,14 @@ export async function del(id: string, flags: Record<string, string | boolean>) {
|
|
|
63
63
|
|
|
64
64
|
export async function importOrg(args: string[], flags: Record<string, string | boolean>) {
|
|
65
65
|
if (flags.help) {
|
|
66
|
-
info('Usage: myapi org import <
|
|
66
|
+
info('Usage: myapi org import <domain> --org <id>\n\nAutomatically extracts brand info from an existing website and updates the organization.\n\nNote: You must create a placeholder organization first using `myapi org create` to get an org_id.');
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
const
|
|
69
|
+
const domain = args[0];
|
|
70
|
+
const orgId = flags.org as string;
|
|
71
71
|
|
|
72
|
-
if (!
|
|
73
|
-
error("Missing arguments
|
|
72
|
+
if (!domain || !orgId) {
|
|
73
|
+
error("Missing required arguments.\nUsage: myapi org import <domain> --org <id>");
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const config = requireConfig();
|