UNPKG

@nexssp/os

Version:

Get linux distro name, distro version, package managers, check isRoot, convert paths.. + now install things easy for all OSes!

32 lines (29 loc) 748 B
const { cli } = require('../cli') module.exports = (command, args) => { const { nexssOS1 } = require('../../config/os-config') const { remove } = require('@nexssp/extend/array') function di(...args) { _log.di(`@os @cli @${command}: `, ...args) } const _log = require('@nexssp/logdebug') let info = nexssOS1.get() let json if (args.includes('--json')) { args = remove(args, '--json') json = true di('json enabled.') } if (args[0]) { if (!Object.keys(info).includes(args[0])) { console.log('For this OS only available:') console.log(Object.keys(info)) return } info = info[`${args[0]}`] } if (json) { console.log(JSON.stringify(info)) } else { console.log(info) } }