{"id":18579808,"url":"https://github.com/pqml/kool-shell","last_synced_at":"2025-04-10T10:31:37.298Z","repository":{"id":69144477,"uuid":"66974127","full_name":"pqml/kool-shell","owner":"pqml","description":":microphone::tv::notes: Fancy node module to deal with shell ","archived":false,"fork":false,"pushed_at":"2018-05-15T14:14:03.000Z","size":176,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T11:20:53.241Z","etag":null,"topics":["ansi","cli","commands","console","inquirer","log","nodejs","prompt","shell","terminal"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pqml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-30T20:09:50.000Z","updated_at":"2018-05-15T14:14:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f30a8a2-f057-4e2a-aa57-5dd0af335d16","html_url":"https://github.com/pqml/kool-shell","commit_stats":{"total_commits":53,"total_committers":4,"mean_commits":13.25,"dds":"0.15094339622641506","last_synced_commit":"ecf82246062511987eec22aa52482b4e737bce4f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pqml%2Fkool-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pqml%2Fkool-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pqml%2Fkool-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pqml%2Fkool-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pqml","download_url":"https://codeload.github.com/pqml/kool-shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199136,"owners_count":21063641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","cli","commands","console","inquirer","log","nodejs","prompt","shell","terminal"],"created_at":"2024-11-06T23:42:11.028Z","updated_at":"2025-04-10T10:31:37.292Z","avatar_url":"https://github.com/pqml.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kool-shell\n#### :microphone::tv::notes: A minimal module to deal with shell\n[![Build Status](https://ci.appveyor.com/api/projects/status/blsw86geesww5453?svg=true)](https://ci.appveyor.com/project/pqml/kool-shell)\n[![Build Status](https://secure.travis-ci.org/pqml/kool-shell.svg)](https://travis-ci.org/pqml/kool-shell)\n\n\u003cbr\u003e\n\n![Spinner](https://cloud.githubusercontent.com/assets/2837959/24589402/ecdd7626-17d9-11e7-92f3-4b993be13f78.gif)\n\n\n\u003cbr\u003e\n\n## Features\n\n* 1 dependency (support-color)\n* Native promises from Nodejs\n* Shell commands with silent \u0026 inherited stdio\n* Ansi Colors + Auto-detects color support\n* Log methods with 4 log levels\n* User input with hidden input option\n* List input with multiple or single choice\n* Awesome emoji-based spinner\n* Progressbar\n* Create and add your own kool-shell plugins easily\n* Cool emojis!\n\n\u003cbr\u003e\n\n## Requirements\n* Node \u003e 8\n* npm \u003e 5\n* ANSI/VT100 compatible terminal\n\n\u003cbr\u003e\n\n## Installation\n\n```sh\nnpm install --save kool-shell\n```\n\n\u003cbr\u003e\n\n## Usage\n#### Create a new kool-shell instance\n```js\nconst sh = require('kool-shell')\nsh.warn(sh.colors.gray('Display a gray warning'))\n\n// You can also use object destructuring\nconst { warn, colors } = require('kool-shell')\nwarn(colors.gray('Display a gray warning'))\n```\n\n#### Namespacing\nIt can be useful to not share kool-shell configuration and state when dealing with\nmultiple modules. You can specify a namespace using the `kool-shell/namespaced` module.\n\n```js\nconst sh1 = require('kool-shell/namespaced')('MyModule')\nsh1.setLogOptions(globalPrefix: '[MyModule] ')\nsh1.log('Customized log for the MyModule namespace')\n\nconst sh2 = require('kool-shell')\nsh2.log('This log will not have the [MyModule] prefix')\n```\n\n\n#### Kool-shell features\n\nAll features are basically native plugins, always available in kool-shell. \u003cbr\u003e\nSee the Plugins section below to learn how to create \u0026 add your own plugins.\n\n* [Log](docs/plugins/log.md) - _Log functions_\n* [Colors](docs/plugins/colors.md) - _Add colors to your log messages_\n* [Progressbar](docs/plugins/progressbar.md) - _Display a progressbar_\n* [Spinner](docs/plugins/spinner.md) - _Display a spinner_\n* [Exec](docs/plugins/exec.md) - _Execute a promised shell command_\n* [Input](docs/plugins/input.md) - _User prompt with hidden input option_\n* [Select](docs/plugins/select.md) - _Select/Radio input_\n* [Cleanup](docs/plugins/cleanup.md) - _Do some actions before exiting your app_\n* [Exit](docs/plugins/exit.md) - _Simple alias of `process.exit(code)`_\n\n\u003cbr\u003e\n\n## Plugins\n\n#### Add a plugin\n\nAdd a plugin with `sh.use(plugin, [options])`.\nYou can specify options for your plugin.\n\n```js\nconst koolPlugin = require('kool-shell-plugin')\nsh.use(koolPlugin, { colors: false })\n```\n\n#### Create a plugin\n\n###### Plugin template\n```javascript\nmodule.exports = myPlugin (sh, opts = {}) {\n  return {\n    sayHello () {\n      // kool-shell native features are always available from the sh object.\n      // for instance, you can easily use colors using sh.colors method\n      opts.gray\n        ? console.log('hello.')\n        : console.log(sh.colors.gray('hello'))\n    }\n  }\n}\n\n```\n\nTwo arguments will be passed when your plugin is used through `sh.use()`:\n* `sh` is the kool-shell instance used\n* `opts` is the options object passed trough `sh.use(plugin, options)`\n\n\u003cbr\u003e\n\n__Your plugin need to be a function that return an object.__ When your plugin is used, the returned object will be merged into the api object of the kool-shell instance.\n\n\u003e :warning:  Method/Property will be overiden if a new one has the same name. Namespace your plugin api if you use common method names\n\n\u003cbr\u003e\n\n## To do\n- Test all native features\n\n\u003cbr\u003e\n\n## License\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpqml%2Fkool-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpqml%2Fkool-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpqml%2Fkool-shell/lists"}