Skip to content

Commit 4e3f579

Browse files
committed
Update v1.3.0
- Add `get` subcommand - Add [api-path, auth-type] aliases to `set` subcommand - Update `set` subcommand descriptions - Update internal logger class - Update README.md
1 parent 51180f9 commit 4e3f579

13 files changed

Lines changed: 248 additions & 119 deletions

File tree

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Use `mdr set username <name>` and `mdr set password <pass>` for this!
4747
- `-h`, `--host` \<host\> - Host name of the template record **[required]**
4848
- `-a`, `--address` \<address\> - Address, url or host name of new record **[required]**
4949
- `details`, `info` - Get dns details from a domain
50-
- `-d`, `--domain` <domain> - Domain name **[required]**
51-
- `-t`, `--tld` <tld> - TLD extension of the domain name **[required]**
50+
- `-d`, `--domain` \<domain\> - Domain name **[required]**
51+
- `-t`, `--tld` \<tld\> - TLD extension of the domain name **[required]**
5252
- `modify`, `mod` - Modify dns records
5353
- `-d`, `--domain` \<domain\> - Domain name **[required]**
5454
- `-t`, `--tld` \<tld\> - TLD extension of the domain name **[required]**
@@ -61,10 +61,16 @@ Use `mdr set username <name>` and `mdr set password <pass>` for this!
6161
- `-s`, `--sort` - Sort the list. Valid options are domein, registrant, admin, tech, verloopdatum or status **[optional]**
6262
- `-o`, `--order` - Specify in which order it should be shown (asc or desc) **[optional]**
6363
- `-b`, `--begin` - Show domain names starting with a letter of the alphabet, values: a-z or 0-9 **[optional]**
64+
- `get`
65+
- `apiPath`, `api-path`, `path` - Get the current api path from the config file
66+
- `authType`, `auth-type`, `auth` - Get the current auth type from the config file
67+
- `host` - Get the current host from the config file
68+
- `ssl` - Get the current ssl value from the config file
69+
- `username`, `user` - Get the current username from the config file
6470
- `set`
65-
- `apiPath`, `path` - Update api path in config file **[required]**
66-
- `authType`, `auth` - Update auth type in config file (plain or md5) **[required]**
67-
- `host` - Update host in config file **[required]**
68-
- `password`, `pwd`, `pw`, `pass`, `passwd` - Update the password in the config file **[required]**
69-
- `ssl` - Enable or disable ssl in the config file, when disabled auth type has to be md5 **[required]**
70-
- `username`, `user` - Update the username in the config file **[required]**
71+
- `apiPath`, `api-path`, `path` - Update api path in the config file
72+
- `authType`, `auth-type`, `auth` - Update auth type in the config file (plain or md5)
73+
- `host` - Update host in the config file
74+
- `password`, `pwd`, `pw`, `pass`, `passwd` - Update the password in the config file
75+
- `ssl` - Enable or disable ssl in the config file, when disabled auth type has to be md5
76+
- `username`, `user` - Update username in the config file

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdr-cli",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "cli to interact with the mijndomeinreseller api",
55
"keywords": [
66
"cli",
@@ -56,9 +56,9 @@
5656
},
5757
"devDependencies": {
5858
"@types/is-base64": "^1.1.0",
59-
"@types/node": "^14.14.7",
60-
"@typescript-eslint/eslint-plugin": "^4.7.0",
61-
"@typescript-eslint/parser": "^4.7.0",
59+
"@types/node": "^14.14.8",
60+
"@typescript-eslint/eslint-plugin": "^4.8.1",
61+
"@typescript-eslint/parser": "^4.8.1",
6262
"cross-env": "^7.0.2",
6363
"eslint": "^7.13.0",
6464
"eslint-config-prettier": "^6.15.0",

src/cli.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#! /usr/bin/env node
22

3+
/**
4+
* @file Main cli file which handles all the commands
5+
* @version 1.3.0
6+
* @author Pepijn van den Broek <pepijn@vdbroek.dev>
7+
* @license MIT
8+
*/
9+
310
import path from "path";
411
import chalk from "chalk";
512
import checkForUpdates from "update-check";

src/commands/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const subcommands: SubcommandDefinition[] = [
2424
},
2525
{
2626
name: "get",
27-
brief: "Get mdr config values (TODO)"
27+
brief: "Get mdr config values"
2828
}
2929
];
3030

src/commands/get/apiPath.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import chalk from "chalk";
2+
import { Command, command, metadata } from "clime";
3+
import { getConfig, logger } from "../../utils/Utils";
4+
5+
@command()
6+
export default class extends Command {
7+
@metadata
8+
async execute(): Promise<void> {
9+
try {
10+
const config = await getConfig();
11+
logger.log(chalk.bold(config.apiPath));
12+
} catch (e) {
13+
logger.error("Failed to get api path");
14+
}
15+
}
16+
}

src/commands/get/authType.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import chalk from "chalk";
2+
import { Command, command, metadata } from "clime";
3+
import { getConfig, logger } from "../../utils/Utils";
4+
5+
@command()
6+
export default class extends Command {
7+
@metadata
8+
async execute(): Promise<void> {
9+
try {
10+
const config = await getConfig();
11+
logger.log(chalk.bold(config.authType));
12+
} catch (e) {
13+
logger.error("Failed to get auth type");
14+
}
15+
}
16+
}

src/commands/get/default.ts

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1-
import {
2-
Command,
3-
command,
4-
Options,
5-
option,
6-
metadata,
7-
// SubcommandDefinition
8-
} from "clime";
1+
import { SubcommandDefinition } from "clime";
92

10-
// export const subcommands: SubcommandDefinition[] = [
11-
// {
12-
// name: "",
13-
// alias: "",
14-
// brief: ""
15-
// }
16-
// ];
17-
18-
export class CmdOptions extends Options {
19-
@option({
20-
name: "temp",
21-
flag: "t",
22-
description: "Temporary",
23-
toggle: true
24-
})
25-
temp!: boolean;
26-
}
27-
28-
@command()
29-
export default class Default extends Command {
30-
@metadata
31-
async execute(options: CmdOptions): Promise<void> {
32-
if (options.temp || !options.temp) {
33-
const help = await Default.getHelp();
34-
help.print(process.stdout, process.stderr);
35-
}
3+
export const subcommands: SubcommandDefinition[] = [
4+
{
5+
name: "apiPath",
6+
aliases: ["path", "api-path"],
7+
brief: "Get the current api path from the config file"
8+
},
9+
{
10+
name: "authType",
11+
aliases: ["auth", "auth-type"],
12+
brief: "Get the current auth type from the config file"
13+
},
14+
{
15+
name: "host",
16+
brief: "Get the current host from the config file"
17+
},
18+
{
19+
name: "ssl",
20+
brief: "Get the current ssl value from the config file"
21+
},
22+
{
23+
name: "username",
24+
alias: "user",
25+
brief: "Get the current username from the config file"
3626
}
37-
}
27+
];

src/commands/get/host.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import chalk from "chalk";
2+
import { Command, command, metadata } from "clime";
3+
import { getConfig, logger } from "../../utils/Utils";
4+
5+
@command()
6+
export default class extends Command {
7+
@metadata
8+
async execute(): Promise<void> {
9+
try {
10+
const config = await getConfig();
11+
logger.log(chalk.bold(config.host));
12+
} catch (e) {
13+
logger.error("Failed to get host");
14+
}
15+
}
16+
}

src/commands/get/ssl.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import chalk from "chalk";
2+
import { Command, command, metadata } from "clime";
3+
import { getConfig, logger } from "../../utils/Utils";
4+
5+
@command()
6+
export default class extends Command {
7+
@metadata
8+
async execute(): Promise<void> {
9+
try {
10+
const config = await getConfig();
11+
logger.log(`${chalk.bold(config.useSSL)} (${config.useSSL ? "enabled" : "disabled"})`);
12+
} catch (e) {
13+
logger.error("Failed to update use SSL");
14+
}
15+
}
16+
}

src/commands/get/username.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import chalk from "chalk";
2+
import { Command, command, metadata } from "clime";
3+
import { getConfig, logger } from "../../utils/Utils";
4+
5+
@command()
6+
export default class extends Command {
7+
@metadata
8+
async execute(): Promise<void> {
9+
try {
10+
const config = await getConfig();
11+
logger.log(chalk.bold(config.user));
12+
} catch (e) {
13+
logger.error("Failed to update username");
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)