clef-parse
Advanced tools
Comparing version 0.2.0 to 0.3.0
export declare const Path: unique symbol; | ||
export declare type Hint = typeof String | typeof Boolean | typeof Number | typeof Path; | ||
export type Hint = typeof String | typeof Boolean | typeof Number | typeof Path; | ||
export declare function parseArgv(argv?: Array<string>, hints?: { | ||
[key: string]: Hint | undefined | null; | ||
}, { isAbsolute, resolvePath, getCwd, }?: { | ||
isAbsolute?: (somePath: string) => boolean; | ||
resolvePath?: (...parts: Array<string>) => string; | ||
getCwd?: () => string; | ||
}): { | ||
@@ -6,0 +10,0 @@ options: any; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -27,3 +8,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const path_1 = __importDefault(require("path")); | ||
const changeCase = __importStar(require("change-case")); | ||
const convert_case_1 = require("./convert-case"); | ||
exports.Path = Symbol("Path"); | ||
@@ -44,3 +25,3 @@ function bestGuess(nextValue) { | ||
} | ||
function parseArgv(argv = process.argv.slice(2), hints = {}) { | ||
function parseArgv(argv = process.argv.slice(2), hints = {}, { isAbsolute = path_1.default.isAbsolute, resolvePath = path_1.default.resolve, getCwd = process.cwd, } = {}) { | ||
const options = {}; | ||
@@ -70,3 +51,3 @@ const positionalArgs = []; | ||
} | ||
propertyName = changeCase.camelCase(item.replace(/^--/, "")); | ||
propertyName = (0, convert_case_1.convertToCamelCase)(item.replace(/^--/, "")); | ||
} | ||
@@ -105,5 +86,5 @@ let propertyValue; | ||
argv.shift(); | ||
propertyValue = path_1.default.isAbsolute(nextValue) | ||
propertyValue = isAbsolute(nextValue) | ||
? nextValue | ||
: path_1.default.resolve(process.cwd(), nextValue); | ||
: resolvePath(getCwd(), nextValue); | ||
break; | ||
@@ -110,0 +91,0 @@ } |
{ | ||
"name": "clef-parse", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Simple, lightweight argv parser. Powers the cleffa and clefairy packages", | ||
@@ -8,3 +8,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "rm -rf dist/* && tsc", | ||
"build": "rm -rf dist/* && tsc --skipLibCheck", | ||
"test": "vitest" | ||
@@ -22,3 +22,3 @@ }, | ||
], | ||
"author": "Lily Scott <me@suchipi.com>", | ||
"author": "Lily Skye <me@suchipi.com>", | ||
"license": "MIT", | ||
@@ -34,6 +34,3 @@ "devDependencies": { | ||
"url": "https://github.com/suchipi/clef-parse.git" | ||
}, | ||
"dependencies": { | ||
"change-case": "^4.1.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
0
8
155
7517
- Removedchange-case@^4.1.2
- Removedcamel-case@4.1.2(transitive)
- Removedcapital-case@1.0.4(transitive)
- Removedchange-case@4.1.2(transitive)
- Removedconstant-case@3.0.4(transitive)
- Removeddot-case@3.0.4(transitive)
- Removedheader-case@2.0.4(transitive)
- Removedlower-case@2.0.2(transitive)
- Removedno-case@3.0.4(transitive)
- Removedparam-case@3.0.4(transitive)
- Removedpascal-case@3.1.2(transitive)
- Removedpath-case@3.0.4(transitive)
- Removedsentence-case@3.0.4(transitive)
- Removedsnake-case@3.0.4(transitive)
- Removedtslib@2.6.3(transitive)
- Removedupper-case@2.0.2(transitive)
- Removedupper-case-first@2.0.2(transitive)