command structure. debugging

This commit is contained in:
Kyle Spearrin 2018-05-12 15:12:28 -04:00
parent 4a0fa7945a
commit bb54e2a381
6 changed files with 135 additions and 6 deletions

15
.editorconfig Normal file
View File

@ -0,0 +1,15 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Set default charset
[*.{js,ts,scss,html}]
charset = utf-8
indent_style = space
indent_size = 4

19
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"protocol": "inspector",
"cwd": "${workspaceRoot}",
"program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
"args": [
"${workspaceFolder}/src/main.ts",
"login",
"kyle@sdfdf.com",
"mypassword"
]
}
]
}

View File

@ -0,0 +1,15 @@
import * as program from 'commander';
import { AuthResult } from 'jslib/models/domain/authResult';
import { AuthService } from 'jslib/abstractions/auth.service';
export class LoginCommand {
constructor(private authService: AuthService) {
}
run(email: string, password: string, cmd: program.Command) {
}
}

View File

@ -1,17 +1,20 @@
import * as program from 'commander';
import { AuthService } from 'jslib/services/auth.service';
import { LoginCommand } from './commands/login.command';
program
.version('1.0.0', '-v, --version');
program
.command('login <email> <password>')
.description('Log into a Bitwarden user account.')
.option('-t, --two_factor <code>', '2FA code.')
.action((email, password, cmd) => {
console.log('Logging in...');
console.log(email);
console.log(password);
console.log(cmd.two_factor);
.option('-m, --method <method>', '2FA method.')
.option('-c, --code <code>', '2FA code.')
.action((email: string, password: string, cmd: program.Command) => {
const command = new LoginCommand(null);
command.run(email, password, cmd);
});
program

24
tsconfig.json Normal file
View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"noImplicitAny": true,
"allowJs": true,
"sourceMap": true,
"baseUrl": ".",
"paths": {
"jslib/*": [
"jslib/src/*"
]
}
},
"exclude": [
"node_modules",
"jslib/node_modules",
"dist",
"jslib/dist",
"jslib/spec",
"jslib/src/electron",
"jslib/src/angular/components/modal.component.ts",
"jslib/src/angular/dummy.module.ts",
"build"
]
}

53
tslint.json Normal file
View File

@ -0,0 +1,53 @@
{
"extends": "tslint:recommended",
"rules": {
"align": [ true, "statements", "members" ],
"ban-types": {
"options": [
[ "Object", "Avoid using the `Object` type. Did you mean `object`?" ],
[ "Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?" ],
[ "Number", "Avoid using the `Number` type. Did you mean `number`?" ],
[ "String", "Avoid using the `String` type. Did you mean `string`?" ],
[ "Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?" ]
]
},
"member-access": [ true, "no-public" ],
"member-ordering": [
true,
{
"order": [
"public-static-field",
"public-static-method",
"protected-static-field",
"protected-static-method",
"private-static-field",
"private-static-method",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"public-constructor",
"protected-constructor",
"private-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
]
}
],
"no-empty": [ true, "allow-empty-catch" ],
"object-literal-sort-keys": false,
"object-literal-shorthand": [ true, "never" ],
"prefer-for-of": false,
"quotemark": [ true, "single" ],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-module",
"check-operator",
"check-preblock",
"check-separator",
"check-type"
]
}
}