@crypticat/cli
Advanced tools
Comparing version 0.1.5 to 0.2.0
@@ -9,4 +9,4 @@ var __importStar = (this && this.__importStar) || function (mod) { | ||
const [_, ...args] = process.argv; | ||
if (args[0] === 'server') { | ||
Promise.resolve().then(() => __importStar(require('./server'))); | ||
if (args[1] === 'serve') { | ||
Promise.resolve().then(() => __importStar(require('./server'))).then(({ go }) => go(parseInt(args[2]) || 8080)); | ||
} | ||
@@ -13,0 +13,0 @@ else { |
@@ -19,2 +19,4 @@ "use strict"; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
const conf_1 = __importDefault(require("conf")); | ||
const config = new conf_1.default(); | ||
const rl = readline_promise_1.default.createInterface({ | ||
@@ -63,4 +65,11 @@ input: process.stdin, | ||
print(chalk_1.default.green('Connection established!')); | ||
print(''); | ||
yield joinRoom('lobby'); | ||
let nick = 'unknown'; | ||
let nick = config.get('nickname', null); | ||
if (nick) { | ||
print(`Your nickname is currently ${chalk_1.default.cyan(nick)}`); | ||
} | ||
else { | ||
print(`Please set a nickname with \`${chalk_1.default.cyan('/nick <nickname>')}\``); | ||
} | ||
while (true) { | ||
@@ -81,2 +90,3 @@ const message = yield input(); | ||
} | ||
print(''); | ||
const room = args[0].startsWith('#') ? args[0].slice(1) : args[0]; | ||
@@ -88,6 +98,10 @@ yield joinRoom(room); | ||
if (!args[0]) { | ||
nick = 'unknown'; | ||
nick = null; | ||
config.delete('nickname'); | ||
print(chalk_1.default.green('Reset nickname')); | ||
break; | ||
} | ||
nick = args.join(' '); | ||
config.set('nickname', nick); | ||
print(chalk_1.default.green(`Updated nickname to ${nick}`)); | ||
break; | ||
@@ -98,5 +112,5 @@ } | ||
} | ||
client.sendMessage(nick, message); | ||
client.sendMessage(nick !== null && nick !== void 0 ? nick : 'unnicked', message); | ||
} | ||
}); | ||
//# sourceMappingURL=client.js.map |
@@ -1,1 +0,1 @@ | ||
export {}; | ||
export declare const go: (port: number) => void; |
@@ -13,3 +13,7 @@ "use strict"; | ||
server.on('dispatch', (from, to) => console.log(`${from.slice(0, 6)} ${chalk_1.default.gray('->')} ${to.slice(0, 6)}`)); | ||
server.listen(8080); | ||
exports.go = (port) => { | ||
console.log(chalk_1.default.green(`Started server on port ${port}`)); | ||
console.log(`Connect with \`${chalk_1.default.cyan(`crypticat ws://localhost:${port}`)}\``); | ||
server.listen(8080); | ||
}; | ||
//# sourceMappingURL=server.js.map |
{ | ||
"name": "@crypticat/cli", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"description": "Crypticat's command-line interface", | ||
@@ -24,12 +24,17 @@ "author": "Kognise <felix.mattick@gmail.com>", | ||
"scripts": { | ||
"tsc": "tsc -p tsconfig.build.json" | ||
"tsc": "tsc -p tsconfig.build.json", | ||
"watch": "tsc --watch" | ||
}, | ||
"dependencies": { | ||
"@crypticat/core": "^0.1.4", | ||
"chalk": "^3.0.0", | ||
"readline-promise": "^1.0.4" | ||
"conf": "^6.2.1", | ||
"readline-promise": "^1.0.4", | ||
"typescript": "^3.8.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^13.9.5", | ||
"typescript": "^3.8.3" | ||
}, | ||
"gitHead": "4c752e81d310236b3a0b5acf1c4c5d39eb3c6e62" | ||
"gitHead": "611a587b42e6320bcfa7afca71062b24d9d46994" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12456
145
5
2
11
+ Added@crypticat/core@^0.1.4
+ Addedconf@^6.2.1
+ Addedtypescript@^3.8.3
+ Added@crypticat/core@0.1.10(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedconf@6.2.4(transitive)
+ Addeddebounce-fn@3.0.1(transitive)
+ Addeddot-prop@5.3.0(transitive)
+ Addedenv-paths@2.2.1(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfind-up@3.0.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedis-obj@2.0.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisomorphic-ws@4.0.1(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-schema-typed@7.0.3(transitive)
+ Addedlocate-path@3.0.0(transitive)
+ Addedmake-dir@3.1.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpkg-up@3.1.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedtypedarray-to-buffer@3.1.5(transitive)
+ Addedtypescript@3.9.10(transitive)
+ Addeduid-promise@1.1.1(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwrite-file-atomic@3.0.3(transitive)
+ Addedws@7.5.10(transitive)