{"id":20002487,"url":"https://github.com/mirkoschubert/yacliui","last_synced_at":"2026-05-12T18:03:45.171Z","repository":{"id":34852194,"uuid":"184747815","full_name":"mirkoschubert/yacliui","owner":"mirkoschubert","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-07T04:51:01.000Z","size":166,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T21:17:04.052Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mirkoschubert.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}},"created_at":"2019-05-03T11:59:24.000Z","updated_at":"2021-07-25T10:26:13.000Z","dependencies_parsed_at":"2022-07-08T00:20:26.580Z","dependency_job_id":null,"html_url":"https://github.com/mirkoschubert/yacliui","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirkoschubert%2Fyacliui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirkoschubert%2Fyacliui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirkoschubert%2Fyacliui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirkoschubert%2Fyacliui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirkoschubert","download_url":"https://codeload.github.com/mirkoschubert/yacliui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241439864,"owners_count":19963143,"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":[],"created_at":"2024-11-13T05:21:46.816Z","updated_at":"2026-05-12T18:03:45.074Z","avatar_url":"https://github.com/mirkoschubert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eYet Another CLI UI Library\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/yacliui\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/yacliui.svg\" alt=\"version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmjs.org/package/yacliui\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/yacliui.svg\" alt=\"downloads\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eA clean UI library in node.js for the command line\u003c/b\u003e\u003cbr /\u003e\n  \u003csub\u003e\u003cb\u003eNote:\u003c/b\u003e This is still work in progress. Please use it with care!\u003c/sub\u003e\n\u003c/p\u003e\n\n---\n\n## Install \u003c!-- omit in toc --\u003e\n\n```bash\nnpm install yacliui\n```\n\n\u003e This package supports Node 8 and above  \u003c!-- omit in toc --\u003e\n\n---\n\nIt's a library. So import it into your scripts first:\n\n```js\nconst ui = require('yacliui')\n```\n\n## API Overview \u003c!-- omit in toc --\u003e\n\n* [Messages](#messages)\n  * [ui.headline(str, align)](#uiheadlinestr-align)\n  * [ui.message(msg, state, showTime)](#uimessagemsg-state-showtime)\n  * [ui.info(msg, showTime)](#uiinfomsg-showtime)\n  * [ui.warning(msg, showTime)](#uiwarningmsg-showtime)\n  * [ui.error(msg, showTime)](#uierrormsg-showtime)\n  * [ui.found(num, topic)](#uifoundnum-topic)\n  * [ui.foundOf(num1, topic1, num2, topic2)](#uifoundofnum1-topic1-num2-topic2)\n* [Lists](#lists)\n  * [ui.list(entries, opts)](#uilistentries-opts)\n  * [ui.definitionList(entries, opts)](#uidefinitionlistentries-opts)\n* [Input](#input)\n  * [ui.ask(question, initial)](#uiaskquestion-initial)\n  * [ui.confirm(question, initial)](#uiconfirmquestion-initial)\n* [Digits](#digits)\n  * [ui.digits(number, opts)](#uidigitsnumber-opts)\n\n## Messages\n\n\u003e See the [Example Script](examples/messages.js) for more info.\n\n### ui.headline(str, align)\n\nType: `Function`\n\nPrints a capitalized green headline with alignment\n\n#### str\n\nType: `String`\n\nThe Headline string to show.\n\n#### align\n\nType: `String`\nDefault: `left`\n\nYou can either use `left`, `center` or `right` for the alignment.\n\n#### Example\n\n```js\nui.headline('Nicely formatted headline')\n```\n\n### ui.message(msg, state, showTime)\n\nType: `Function`\n\nYou can print a simple message with or without a **timestamp**, **status string** and **colored status code**.\n\n#### msg\n\nType: `String`\n\n#### state\n\nType: `String|Number`\n\n#### showTime\n\nType: `Boolean`\n\n#### Example\n\n```js\nui.message('Message without anything')\nui.message('Message with time code', true)\nui message('Message with time code and status string', '15ms', true)\nui.message('Message with time code and status code (warning)', 301, true)\n```\n\n### ui.info(msg, showTime)\n\nType: `Function`\n\nShortcut for an info message in **white** with or without time stamp.\n\n#### Example\n\n```js\nui.info('Info message in white')\n```\n\n### ui.warning(msg, showTime)\n\nType: `Function`\n\nShortcut for an warning message in **yellow** with or without time stamp.\n\n#### Example\n\n```js\nui.warning('Warning message in yellow')\n```\n\n### ui.error(msg, showTime)\n\nType: `Function`\n\nShortcut for an error message in **red** with or without time stamp.\n\n#### Example\n\n```js\nui.error('Error message in red', true) // with time stamp\n```\n\n### ui.found(num, topic)\n\nType: `Function`\n\nShows a message how many items of a specific topic have been found.\n\nPlease note that the topic is an array of two strings: The `singular` and the `plural`! This only works in English since the function automatically uses »has been found« or »have been found«.\n\n#### num\n\nType: `Number`\n\nThe number of items.\n\n#### topic\n\nType: `Array`\n\nAn Array of the singular and plural word of the topic, such as:\n\n```js\nconst topic = ['item', 'items']\n```\n\n#### Example\n\n```js\nui.found(1, ['apple', 'apples'])\n// Output: 1 apple has been found.\nui.found(6, ['apple', 'apples'])\n// Output: 6 apples have been found.\n```\n\n### ui.foundOf(num1, topic1, num2, topic2)\n\nType: `Function`\n\nThis function is basically the same as `ui.found()`, but shows how many items of a topic have been found in a number of items in another topic.\n\nThe options are the same like in the function above, but twice. You can leave the first topic array empty if you like.\n\n#### Example\n\n```js\nui.foundof(7, [], 10, ['apple', 'apples'])\n// Output: 7 of 10 apples have been found.\nui.foundOf(3, ['piece', 'pieces'], 10, ['apple', 'apples'])\n// Output: 3 pieces of 10 apples have been found.\n```\n\n## Lists\n\n\u003e See the [Example Script](examples/lists.js) for more info.\n\n### ui.list(entries, opts)\n\nType: `Function`\n\nShow an array as an unordered or ordered list.\n\n#### entries\n\nType: `Array`\n\nList entries as an array of strings.\n\n#### opts.ordered\n\nType: `Boolean`\nDefault: `false`\n\nShow an ordered list instead of an unordered one.\n\n#### Example\n\n```js\nui.list(['first', 'second', 'third'], { ordered: true })\n```\n\n### ui.definitionList(entries, opts)\n\nShow a definition list of an array of objects with **term** and **definition**:\n\n#### entries\n\nType: `Array`\n\nDefinition list entries as an array of objects. The objects contain `term` and `definition`:\n\n```js\n{\n  term: 'UI',\n  definition: 'User Interface'\n}\n```\n\n#### opts.ordered\n\nType: `Boolean`\nDefault: `false`\n\nShow an ordered definition list instead of an unordered one. This shows three rows instead of two.\n\n#### opts.padding\n\nType: `Number`\nDefault: `2`\n\nPadding between term and definition.\n\n#### Example\n\n```js\nui.definitionList([\n  {\n    term: 'First term',\n    definition: 'First definition'\n  },\n  {\n    term: 'First term',\n    definition: 'First definition'\n  }\n], { padding: 4 })\n```\n\n## Input\n\n\u003e See the [Example Script](examples/input.js) for more info.\n\n**Note:** For now I use the popular library [Prompts](https://www.npmjs.com/package/prompts) for the input section. I will code this later myself, so there is not another big dependency.\n\n### ui.ask(question, initial)\n\nType: `Async Function`\nReturns: `String`\n\nPrompts a question and will return either the initial answer or the string the user has put in.\n\n#### question\n\nType: `String`\n\nThe question the user will be asked.\n\n#### initial\n\nType: `String`\n\nThe default value of an answer the user can confirm with \u003ckbd\u003eenter\u003c/kbd\u003e.\n\n#### Example\n\n```js\n(async () =\u003e {\n  var answer = await ui.ask('What is your name?', 'Anonymous')\n  console.log('Your name is ' + answer + '.')\n})()\n```\n\n### ui.confirm(question, initial)\n\nType: `Async Function`\nReturns: `Boolean`\n\nPrompts any question the user can answer with `yes` or `no`.\n\n#### question\n\nType: `String`\n\nThe question the user will be asked.\n\n#### initial\n\nType: `Boolean`\n\nThe default value of an answer the user can confirm with \u003ckbd\u003eenter\u003c/kbd\u003e.\n\n#### Example\n\n```js\n(async () =\u003e {\n  var pretty = await ui.confirm('Are you pretty?', true)\n  if (pretty) {\n    console.log('Yes, you are pretty!')\n  } else {\n    console.log('You are ugly as hell!')\n  }\n})()\n```\n\n## Digits\n\n\u003e See the [Example Script](examples/digits.js) for more info.\n\n### ui.digits(number, opts)\n\nType: `Function`\n\nPrints a huge 3x5 font for numbers like temperatue or time. Please note, that this function is still under development!\n\n#### number\n\nType: `Number|String`\n\nThe number to be displayed. Please note that by now only `Numbers` are fully functioning!\n\n#### opts.max_digits\n\nType: `Number`\nDefault: `4`\n\nThe maximum of digits to be displayed.\n\n#### opts.max_decimals\n\nType: `Number`\nDefault: `2`\n\nThe maximum of decimals to be displayed.\n\n#### opts.fixed\n\nType: `Boolean`\nDefault: `true`\n\nIf this option is `true`, the number of displayed characters always stay the same. If a number isn't in range of `opts.max_digits` and `opts.max_decimals` the number will be rounded within their boundaries.\n\nIf `opts.fixed` is `false`, only `opts.max_decimals` will be considered.\n\n#### opts.color\n\nType: `String`\nDefault: `green`\n\nThis is the color the whole number will be displayed in. You can use any definition of the color library [chalk](https://www.npmjs.com/package/chalk), e.g. `blue.dim` or `white.bgRed`.\n\n#### Example\n\n```js\nui.digits(12.479, {\n  max_decimals: 2,\n  color: 'blue.dim'\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirkoschubert%2Fyacliui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirkoschubert%2Fyacliui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirkoschubert%2Fyacliui/lists"}