{"id":13602272,"url":"https://github.com/fabiospampinato/tiny-bin","last_synced_at":"2025-04-11T23:15:48.545Z","repository":{"id":65786146,"uuid":"599811823","full_name":"fabiospampinato/tiny-bin","owner":"fabiospampinato","description":"A library for building tiny and beautiful command line apps.","archived":false,"fork":false,"pushed_at":"2025-02-23T13:29:30.000Z","size":287,"stargazers_count":190,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T23:15:43.929Z","etag":null,"topics":["app","bin","cli","command","line","tiny"],"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/fabiospampinato.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},"funding":{"github":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2023-02-09T23:38:50.000Z","updated_at":"2025-02-23T13:29:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"68b85d0a-0c61-4d07-971e-5701787a05b2","html_url":"https://github.com/fabiospampinato/tiny-bin","commit_stats":{"total_commits":37,"total_committers":1,"mean_commits":37.0,"dds":0.0,"last_synced_commit":"89a691867b49baea3fde5996f4021a3587bec19d"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-bin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-bin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-bin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-bin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/tiny-bin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492884,"owners_count":21113163,"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":["app","bin","cli","command","line","tiny"],"created_at":"2024-08-01T18:01:18.540Z","updated_at":"2025-04-11T23:15:48.524Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":["TypeScript","cli"],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./resources/demo.png\" alt=\"Demo app\" width=\"681px\"\u003e\n\u003c/p\u003e\n\n# Tiny Bin\n\nA library for building tiny and beautiful command line apps.\n\n## Features\n\nAt a high level this package provides:\n\n- A tiny library, that has no third-party dependencies, that can be bundled, for great startup performance.\n- Beautiful colored and detailed help pages. Colors can be turned off also.\n- Automatic update notifications, that will notify the user of an update right before exiting.\n- Automatic package name and version detection, so you don't even need to provide those.\n- Automatic typo detection, it will suggest the closest command/option if you mistype one.\n- Automatic `help` and `--help` handling, both for the bin and for each command.\n- Automatic `--version` and `-v` handling.\n- Automatic `--no-color` and `--no-colors` handling.\n\nThis library has 5 primitives, bins, commands, options, arguments and actions:\n\n- Bin:\n  - A bin is the entry point of your command line app, you can define multiple bins.\n  - Each bin has a name, a description, and a few built-in commands (default, help, version).\n  - Each bin can have multiple custom commands.\n  - The action for the default command is customizable.\n- Command:\n  - A command is the function that will be executed when running your bin.\n  - Each command has a name, a description, and an automatically generated usage example.\n  - Each command can optional have a section, which will be used to group commands in the help page.\n  - Each command can optionally be hidden from the help page.\n  - Each command can optionally have custom usage examples.\n  - Each command can have multiple options.\n  - Each command can have multiple arguments.\n  - Each command has an action, which is your actual function that will called by the command.\n- Option:\n  - An option is a flag that can be passed to your command.\n  - Each option has a name, a description, and an implicit type (boolean or string).\n  - Each option can optional have a section, which will be used to group options in the help page.\n  - Each option can optionally be hidden from the help page.\n  - Each option can optionally be marked as deprecated, causing it to be dimmed in the help page.\n  - Each option can optionally be marked as eager, so it will consume multiple consecutive values.\n  - Each option can optionally be marked as incompatible with some others.\n  - Each option can optionally be marked as required, so the library will error if it's not provided.\n  - Each option can optionally be marked as explicitly overriding a previously defined option.\n  - Each option can optionally have a default value.\n  - Each option can optionally have an explicit list of allowed values.\n  - Each option can have multiple longhands (e.g. `--foo`) and multiple shorthands (e.g. `-f`).\n  - Each provided longhand and shorthand for an option is automatically aliased to all the others.\n  - Each non-boolean option must receive at least one value.\n  - Each variadic option can receive multiple values (e.g. `\u003cvalues...\u003e`).\n- Argument:\n  - An argument is a value that can be passed to your command.\n  - Each argument has a name and a description.\n  - Each argument can be marked as required, so the library will error if it's not provided.\n  - Each variadic argument (e.g. `\u003cargs...\u003e`) can receive multiple values.\n- Action:\n  - An action is the function that will be called when running your command.\n  - It will receive the following arguments:\n    - The options object, containing all options for which the library has a value.\n    - The arguments array, contaning an array of strings passed to your command.\n    - The passthrough arguments array, containing an array of strings passed to your command after the special `--` separator.\n\n## Install\n\n```sh\nnpm install --save tiny-bin\n```\n\n## Usage\n\n```ts\nimport bin from 'tiny-bin';\n\nbin ( 'gitman', 'A simple yet powerful opinionated tool for managing repositories' )\n  /* BIN OPTIONS */\n  .colors ( false ) // Turn off colored output\n  .package ( '@fabiospampinato/gitman', '1.2.3' ) // Set the package name and version number manually\n  .autoExit ( false ) // Turn off the automatic process.exit call after action execution\n  .autoUpdateNotifier ( false ) // Turn off the automatic update notifier\n  /* GLOBAL COMMAND OPTIONS */\n  .option ( '--silent, -s', 'Silence all output' )\n  .option ( '--verbose, -V', 'Verbose output' )\n  .option ( '--provider, -p \u003cprovider\u003e', 'The provider to use', { default: 'github', enum: ['github', 'gitlab'] } )\n  .option ( '--token, -t \u003ctoken\u003e', 'GitHub/GitLab personal access token', { required: true } )\n  /* DEFAULT COMMAND ARGUMENTS */\n  .argument ( '[user]', 'The name of the user' )\n  .argument ( '\u003crepo\u003e', 'The name of the repository' )\n  /* DEFAULT COMMAND ACTION */\n  .action ( ( options, args, passthroughArgs ) =\u003e {\n    console.log ( 'Default command executed' );\n    console.log ( options );\n    console.log ( args );\n    console.log ( passthroughArgs );\n  })\n  /* CUSTOM COMMAND */\n  .command ( 'clone', 'Clone a repository' )\n  /* CUSTOM COMMAND OPTIONS */\n  .option ( '--submodules', 'Clone submodules too' )\n  /* CUSTOM COMMAND ARGUMENTS */\n  .argument ( '[user]', 'The name of the user' )\n  .argument ( '\u003crepo\u003e', 'The name of the repository' )\n  /* CUSTOM COMMAND ACTION */\n  .action ( ( options, args, passthroughArgs ) =\u003e {\n    console.log ( 'Clone command executed' );\n    console.log ( options );\n    console.log ( args );\n    console.log ( passthroughArgs );\n  })\n  /* EXECUTING THE BIN */\n  .run ();\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ftiny-bin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Ftiny-bin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ftiny-bin/lists"}