@cloud-cli/dns 2.0.3 → 2.1.0

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/index.d.ts CHANGED
@@ -19,5 +19,18 @@ declare const _default: {
19
19
  reload: typeof reload;
20
20
  get: typeof get;
21
21
  [init]: typeof addDnsConfig;
22
+ help: () => {
23
+ description: string;
24
+ commands: {
25
+ 'dns add [domain]': string;
26
+ 'dns remove [domain]': string;
27
+ 'dns list': string;
28
+ 'dns get [domain]': string;
29
+ };
30
+ options: {
31
+ domain: string;
32
+ target: string;
33
+ };
34
+ };
22
35
  };
23
36
  export default _default;
package/dist/index.js CHANGED
@@ -42,11 +42,31 @@ function addDnsConfig() {
42
42
  Object.assign(dnsConfig, getConfig('dns'));
43
43
  }
44
44
  function save(list) {
45
- let lines = list.map(next => next.target + ' ' + next.domain);
45
+ let lines = list.map((next) => next.target + ' ' + next.domain);
46
46
  fs.writeFileSync(filePath, lines.join('\n').trim());
47
47
  }
48
48
  export function parseDNSLine(line) {
49
49
  const [ip, ...domains] = line.split(/\s+/);
50
50
  return domains.map((d) => ({ domain: d, target: ip }));
51
51
  }
52
- export default { add, remove, list, reload, get, [init]: addDnsConfig };
52
+ export default {
53
+ add,
54
+ remove,
55
+ list,
56
+ reload,
57
+ get,
58
+ [init]: addDnsConfig,
59
+ help: () => ({
60
+ description: 'Manage DNS host entries',
61
+ commands: {
62
+ 'dns add [domain]': 'Add a DNS entry for a domain (defaults to 127.0.0.1 if no target specified)',
63
+ 'dns remove [domain]': 'Remove a DNS entry for a domain',
64
+ 'dns list': 'List all DNS entries',
65
+ 'dns get [domain]': 'Get DNS entry for a specific domain',
66
+ },
67
+ options: {
68
+ domain: 'Domain name',
69
+ target: 'IP address (defaults to 127.0.0.1)',
70
+ },
71
+ }),
72
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/dns",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -64,7 +64,7 @@ function addDnsConfig() {
64
64
  }
65
65
 
66
66
  function save(list: DomainAndTarget[]) {
67
- let lines = list.map(next => next.target + ' ' + next.domain);
67
+ let lines = list.map((next) => next.target + ' ' + next.domain);
68
68
  fs.writeFileSync(filePath, lines.join('\n').trim());
69
69
  }
70
70
 
@@ -73,4 +73,24 @@ export function parseDNSLine(line: string): DomainAndTarget[] {
73
73
  return domains.map((d) => ({ domain: d, target: ip }));
74
74
  }
75
75
 
76
- export default { add, remove, list, reload, get, [init]: addDnsConfig };
76
+ export default {
77
+ add,
78
+ remove,
79
+ list,
80
+ reload,
81
+ get,
82
+ [init]: addDnsConfig,
83
+ help: () => ({
84
+ description: 'Manage DNS host entries',
85
+ commands: {
86
+ 'dns add [domain]': 'Add a DNS entry for a domain (defaults to 127.0.0.1 if no target specified)',
87
+ 'dns remove [domain]': 'Remove a DNS entry for a domain',
88
+ 'dns list': 'List all DNS entries',
89
+ 'dns get [domain]': 'Get DNS entry for a specific domain',
90
+ },
91
+ options: {
92
+ domain: 'Domain name',
93
+ target: 'IP address (defaults to 127.0.0.1)',
94
+ },
95
+ }),
96
+ };