{"id":16329143,"url":"https://github.com/thassiov/framed-commands","last_synced_at":"2025-08-17T09:32:57.904Z","repository":{"id":82573745,"uuid":"340749460","full_name":"thassiov/framed-commands","owner":"thassiov","description":"A snippet/cheatsheet application. So you don't have to memorize everything.","archived":false,"fork":false,"pushed_at":"2024-01-08T22:56:40.000Z","size":2650,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-11T23:17:06.482Z","etag":null,"topics":["cheatsheet","command-line","tui","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/thassiov.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}},"created_at":"2021-02-20T20:43:03.000Z","updated_at":"2024-01-08T14:22:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7795416-e3bb-404d-a5f0-59731179a5b2","html_url":"https://github.com/thassiov/framed-commands","commit_stats":null,"previous_names":["thassiov/cast","thassiov/framed-commands"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thassiov%2Fframed-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thassiov%2Fframed-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thassiov%2Fframed-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thassiov%2Fframed-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thassiov","download_url":"https://codeload.github.com/thassiov/framed-commands/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230113651,"owners_count":18175221,"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":["cheatsheet","command-line","tui","typescript"],"created_at":"2024-10-10T23:14:42.608Z","updated_at":"2024-12-17T12:13:38.424Z","avatar_url":"https://github.com/thassiov.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"tuizer-demo.gif\"\u003e\n  \u003ch5\u003eMake a TUI app using a config file\u003c/h5\u003e\n\u003c/div\u003e\n\n# tuizer\n\n## Install\n\n```bash\nnpm install -g tuizer\n```\n\n## What is does\n\nFrom a config file, it creates a menu where you can execute commands. A small description of the command is also shown, if provided.\n\n\u003cdetails\u003e\u003csummary\u003eWhy (the motivation behind it)\u003c/summary\u003e\n\nI don't remember all the possible commands from an application and I didn't wanted to keep trying to dig through documentation to find the correct combination of options to do a certain operation. Also I didn't want to created a lot of custom scripts to do those things, like having a script that does `ls -la` alone, for instance.\n\nIf I find a command that I want to use, but don't do it very often and don't want to lose it, or I want to study some application, like terraform or some other thing that has a bunch of different commands, I would want something like this available: feed a json file with the stuff you don't want to lose (commands and their descriptions) and the app will create a little menu for you.\n\n\u003c/details\u003e\n\n## How it works\n\n`tuizer` can be fed a JSON or YAML file directly or, if no file is provided, it searches for the `$HOME/.tuizer` directory for files.\n\n```bash\n# the '.json' extension is optional if the format is json\ntuizer ./some-json-file.json\ntuizer ./some-json-file\n\nor\n\n# the '.yaml' or '.yml' extension is required if the format is yaml\ntuizer ./some-yaml-file.yaml\n\n# or\n\n# this will launch a selection menu with the `$HOME/.tuizer`'s content\ntuizer\n\n```\n\nMake sure to create the `$HOME/.tuizer` directory and put your configs there if you don't want to provide them as argument everytime.\n\n## The config file\n\nAs mentioned, the config can be both a JSON or a YAML file.\nThe description here only mentions JSON, but an alternative doc will be written later with the YAML structure. At the end of this doc there are a JSON file example and a YAML file example converted from JSON using [json formatter](https://jsonformatter.org/).\n\n### The base structure\n\n```json\n{\n  \"name\": \"These are the commands I am learning\",\n  \"commands\": [\u003ccommand_structure\u003e]\n}\n```\n\nThe base structure only has 2 properties, one of them optional:\n\n|name |type  |required |\n--- | --- | ---\n|`name`|string|no|\n|`commands`|array of `comand`|yes|\n\n\n### The `command` structure\n\n```json\n{\n  \"command\": \"some_command\",\n  \"parameters\": [\u003cparameters_structure\u003e],\n  \"description\": \"the command's description\",\n  \"nameAlias\": \"an alias to show in the menu instead of the command (because it might be big)\"\n},\n```\n\n|name |type  |required |\n--- | --- | ---\n|`comand`|string|yes|\n|`parameters`|array of `parameters`|yes|\n|`description`|string|yes|\n|`nameAlias`|string|yes|\n\n### The `parameters` structure\n\nThe `parameters` property can receive two types of elements: `strings` and `input object` structures.\n\n#### The `input object` structure\n\nThe idea behind the structure is that there might be commands that need user input to *set parameters*.\nThis *does not* enable the user to interact with the application run by `tuizer`, but only set the parameters for it to run.\n\n```json\n{\n  \"type\":\"string\",\n  \"required\":true,\n  \"parameter\":\"\",\n  \"question\":\"Enter the cluster's name\",\n  \"defaultValue\": \"myCluster\"\n}\n```\n\n|name |type  |required |description |\n--- | --- | --- | ---\n|`type`|only `string` for now|yes|the type of the input|\n|`required`|`boolean`|no|input is obligatory|\n|`parameter`|`string`|yes|more info in the next section|\n|`question`|`string`|yes|the sentence that will appear in the form for this parameter|\n|`defaultValue`|`string`|no|if the user does not input anything, this value will be used|\n\nRight now we only have `string` as a type, but in the future there will be `select`, `date`, maybe a `multiSelect`, who knows...😬\n\n##### The `parameter` property\n\nThere are two ways to set this property:\n\n- leaving it blank and the parameter will be replaced by the answer given in the form, or\n- putting a string with a unescaped `$` in the middle that will be replaced by the answer\n\nThe idea of the `$` character is that sometimes the information is in the middle of the string, so if you have a parameter like `--file log.\u003cnumber\u003e.txt` and you want to change the `\u003cnumber\u003e` part, you would write it as `--file log.$.txt` in the `parameter` field. The answer given in the form will replace the `$` character.\n\n## Example of a JSON file\n\nHere's how it looks like with all the structures in place (json taken from the project's `example` directory)\n\n```json\n{\n  \"name\":\"K3D Kubernetes\",\n  \"commands\": [\n    {\n      \"command\":\"k3d\",\n      \"parameters\": [\n        \"cluster\",\n        \"list\"\n      ],\n      \"description\":\"Lists all k3d clusters\",\n      \"nameAlias\":\"list clusters\"\n    },\n    {\n      \"command\":\"k3d\",\n      \"parameters\": [\n        \"cluster\",\n        \"start\",\n        {\n          \"type\":\"string\",\n          \"required\":true,\n          \"parameter\":\"\",\n          \"question\":\"Enter the cluster's name\",\n          \"defaultValue\": \"myCluster\"\n        }\n      ],\n      \"description\":\"Starts a named cluster (user input or 'my-cluster' by default)\",\n      \"nameAlias\":\"starts a named cluster\"\n    },\n    {\n      \"command\":\"k3d\",\n      \"parameters\": [\n        \"node\",\n        \"create\",\n        {\n          \"type\":\"string\",\n          \"required\":true,\n          \"parameter\":\"\",\n          \"question\":\"Enter the worker node's name\",\n          \"defaultValue\": \"myWorker\"\n        },\n        \"--replicas\",\n        {\n          \"type\":\"string\",\n          \"required\":true,\n          \"parameter\":\"\",\n          \"question\":\"Enter the number of replicas of worker nodes\",\n          \"defaultValue\": \"2\"\n        },\n        \"--cluster\",\n        {\n          \"type\":\"string\",\n          \"required\":true,\n          \"parameter\":\"\",\n          \"question\":\"Enter the cluster's name\",\n          \"defaultValue\": \"myCluster\"\n        }\n      ],\n      \"description\":\"Adds a number of worker nodes (user input or 2 by default) with a given name (user input or 'myWorker' by default) in a named cluster (user input or 'myCluster' by default)\",\n      \"nameAlias\":\"adds N named workers in a named cluster\"\n    }\n  ]\n}\n```\n\n## Example of a YAML file (the same JSON, but converted using [json formatter](https://jsonformatter.org/)).\n\n```yaml\nname: K3D Kubernetes\ncommands:\n  - command: k3d\n    parameters:\n      - cluster\n      - list\n    description: Lists all k3d clusters\n    nameAlias: list clusters\n  - command: k3d\n    parameters:\n      - cluster\n      - start\n      - type: string\n        required: true\n        parameter: ''\n        question: Enter the cluster's name\n        defaultValue: myCluster\n    description: Starts a named cluster (user input or 'my-cluster' by default)\n    nameAlias: starts a named cluster\n  - command: k3d\n    parameters:\n      - node\n      - create\n      - type: string\n        required: true\n        parameter: ''\n        question: Enter the worker node's name\n        defaultValue: myWorker\n      - '--replicas'\n      - type: string\n        required: true\n        parameter: ''\n        question: Enter the number of replicas of worker nodes\n        defaultValue: '2'\n      - '--cluster'\n      - type: string\n        required: true\n        parameter: ''\n        question: Enter the cluster's name\n        defaultValue: myCluster\n    description: \u003e-\n      Adds a number of worker nodes (user input or 2 by default) with a given\n      name (user input or 'myWorker' by default) in a named cluster (user input\n      or 'myCluster' by default)\n    nameAlias: adds N named workers in a named cluster\n```\n\n## Contributing\n\nSend pull requests, idk\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthassiov%2Fframed-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthassiov%2Fframed-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthassiov%2Fframed-commands/lists"}