Skip to content

Commit

Permalink
added cli
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianMairinger committed May 19, 2023
1 parent 549c6c3 commit 73ebcf3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 38 deletions.
11 changes: 6 additions & 5 deletions app/src/cli/crossPlatformSpecs-cli.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
#!/usr/bin/env node
import crossPlatformSpecs from "../crossPlatformSpecs.js"
import * as spec from "../crossPlatformSpecs.js"
import { program } from "commander"
import reqPackageJson, { reqPackagePath } from "req-package-json"
import {promises as fs} from "fs"
import * as path from "path"
const config = reqPackageJson()
import * as console from "./../lib/logger"


program
.version(config.version)
.description(config.description)
.name(config.name)
.option('-s, --silent', 'silence stdout')
// .argument('<required example>', "description of required example")
// .argument('[optional example]', "description of optional example")
.action((arg1, arg2, options) => {
.argument('[specific spec]', `Optionally provide a spec name of interest to only return that spec. Can be one of ["environment", "osName", "osVersion", "runtime", "runtimeVersion", "engine", "engineVersion", "cpuName", "cpuCores", "cpuArch", "memAvailable", "memFree"]. If omitted, a summery of all specs will be returned.`)
.action((spec, options) => {
console.setVerbose(!options.silent)

// crossPlatformSpecs()


if (spec !== undefined) console.log(spec[spec])
else console.log(spec.allSpecs())
})

.parse(process.argv)
Expand Down
32 changes: 0 additions & 32 deletions cjsIfyMod.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Aggregation of functions to get system specs with a unified API for web and node.",
"main": "./app/dist/esm/crossPlatformSpecs.mjs",
"types": "./app/dist/esm/crossPlatformSpecs.d.ts",
"bin": "./app/dist/cjs/cli/crossPlatformSpecs-cli.js",
"bin": "./app/dist/esm/cli/crossPlatformSpecs-cli.mjs",
"exports": {
"node": {
"import": "./app/dist/esm/crossPlatformSpecs.mjs",
Expand Down

0 comments on commit 73ebcf3

Please sign in to comment.