diff --git a/2018/13/solve.js b/2018/13/solve.js index f3fb2c4..0dca0c0 100755 --- a/2018/13/solve.js +++ b/2018/13/solve.js @@ -6,11 +6,12 @@ const solve1 = () => { getRows() .then(data => console.log(findCollisionLocation(data))); }; +// eslint-disable-next-line no-unused-vars const solve2 = () => { getRows() .then(data => console.log((data))); }; solve1(); -//solve2(); +// solve2(); // 44,88 diff --git a/2018/16/opcodes.js b/2018/16/opcodes.js index c3b4bd3..7ce2f4f 100644 --- a/2018/16/opcodes.js +++ b/2018/16/opcodes.js @@ -79,6 +79,7 @@ const getOperations = (input) => { const registryBefore = getRegistryBefore(before); const [instruction, a, b, c] = getInstructions(inst); const registryAfter = getRegistryAfter(after); + // eslint-disable-next-line no-loop-func Object.entries(ops).forEach(([name, op]) => { const registry = applyOp(op, registryBefore, a, b, c); if (isEqual(registry, registryAfter)) { @@ -94,6 +95,7 @@ const getOperations = (input) => { const opCodes = {}; while (foundInstructions < 16) { + // eslint-disable-next-line no-loop-func Object.entries(opCandidates).forEach(([name, candidates]) => { if (candidates.length === 1) { const foundNum = candidates[0]; diff --git a/bin/advent.js b/bin/advent.js new file mode 100755 index 0000000..99f2a52 --- /dev/null +++ b/bin/advent.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +const cli = require('../src/cli'); + +cli(); diff --git a/package.json b/package.json index 6756e75..13ba9da 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "lint": "eslint .", "test": "jest" }, + "bin": { + "advent": "./bin/advent.js" + }, "main": "index.js", "author": "Hank", "license": "MIT", @@ -16,6 +19,7 @@ "jest": "^24.9.0" }, "dependencies": { + "commander": "^2.19.0", "dotenv": "^6.1.0", "find-config": "^1.0.0", "node-fetch": "^2.3.0", diff --git a/src/cli.js b/src/cli.js new file mode 100644 index 0000000..ad18bd1 --- /dev/null +++ b/src/cli.js @@ -0,0 +1,42 @@ +const path = require('path'); +const { Command } = require('commander'); + +const init = require('./init'); + + +const main = (args = process.argv, program = new Command()) => { + const defaultNameTemplate = 'solve.js'; + const defaultTemplateFile = path.resolve(__dirname, 'templates', 'day.js'); + + program.on( + '--help', () => { + console.log('hej'); + }, + ); + + let action; + + program + .command('init ') + .description('Initialize a given day') + .option( + '-n, --name-template [template', + 'The template filename', + defaultNameTemplate, + ) + .option( + '-t, --template-file [filepath]', + 'The path to the template file', + defaultTemplateFile, + ) + .action((day, command) => { + console.log(day, command); + action = init(); + }); + + program.parse(args); + + return action; +}; + +module.exports = main; diff --git a/src/init.js b/src/init.js new file mode 100644 index 0000000..177709b --- /dev/null +++ b/src/init.js @@ -0,0 +1,6 @@ +const init = (config) => { + console.log(config); + return Promise.all([]); +}; + +module.exports = init; diff --git a/src/templates/day.js b/src/templates/day.js new file mode 100644 index 0000000..e69de29 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy