{"name":"tiny-bin","version":"1.11.3","keywords":["tiny","bin","command","line","app","cli"],"license":"MIT","_id":"tiny-bin@1.11.3","maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"homepage":"https://github.com/fabiospampinato/tiny-bin#readme","bugs":{"url":"https://github.com/fabiospampinato/tiny-bin/issues"},"dist":{"shasum":"8b21582d62aef2af5a81cd3ec2b241b5d4148cb8","tarball":"http://registry-npm.ywwl.com/tiny-bin/download/tiny-bin-1.11.3.tgz","fileCount":45,"integrity":"sha512-CrBbiKsvJN4bHSDA0cPau4t5KWdGUUAcTXQ8bB14XNqNY+68UZF4Zo7WRVdHLq0j0GYZjIRbNDg+zJbJXDEXeg==","signatures":[{"sig":"MEUCIQDVQKnWd8LiAccNlmwEw9kUKymIIRZ20gPpkz9G/UEHbwIgKkQp73FysbpjtQuUsKp875Oij352s73V/FOQ4j6IAOA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":49658,"size":12615,"noattachment":false,"key":"/tiny-bin/-/tiny-bin-1.11.3.tgz"},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","exports":"./dist/index.js","gitHead":"78ced4e0e049151f4f80a0877b43e18e3d07b2d6","scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","prepublishOnly":"tsex prepare"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"repository":{"url":"git+https://github.com/fabiospampinato/tiny-bin.git","type":"git"},"_npmVersion":"10.2.3","description":"A library for building tiny and beautiful command line apps.","directories":{},"_nodeVersion":"18.19.0","dependencies":{"ansi-purge":"^1.0.1","tiny-colors":"^2.2.2","tiny-updater":"^3.5.3","tiny-parse-argv":"^2.8.2","tiny-levenshtein":"^1.1.0","fast-string-width":"^3.0.1","get-current-package":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsex":"^4.0.2","typescript":"^5.7.3","@types/node":"^18.19.74"},"_npmOperationalInternal":{"tmp":"tmp/tiny-bin_1.11.3_1755876659989_0.15426038186426472","host":"s3://npm-registry-packages-npm-production"},"readme":"\n<p align=\"center\">\n  <img src=\"./resources/demo_gitman.png\" alt=\"Demo app\" width=\"681px\">\n</p>\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 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 options type inference from the provided options.\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. `<values...>`).\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. `<args...>`) 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 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 CONFIGURATION */\n  .config ({\n    package: '@fabiospampinato/gitman', // Manually set the package name\n    version: '1.2.3', // Manually set the version number\n    colors: false, // Turn off colored output\n    autoExit: false // Turn off the automatic process.exit call after action execution\n  })\n  /* GLOBAL COMMAND OPTIONS */\n  .option ( '--silent, -s', 'Silence all output' )\n  .option ( '--verbose, -V', 'Verbose output' )\n  .option ( '--provider, -p <provider>', 'The provider to use', { default: 'github', enum: ['github', 'gitlab'] } )\n  .option ( '--token, -t <token>', 'GitHub/GitLab personal access token', { required: true } )\n  .option ({ name: '--example, -e <foo>', description: 'An example option configuration provided as a single object' })\n  /* DEFAULT COMMAND ARGUMENTS */\n  .argument ( '[user]', 'The name of the user' )\n  .argument ( '<repo>', 'The name of the repository' )\n  /* DEFAULT COMMAND ACTION */\n  .action ( ( options, args, passthroughArgs ) => {\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 ( '<repo>', 'The name of the repository' )\n  /* CUSTOM COMMAND ACTION */\n  .action ( ( options, args, passthroughArgs ) => {\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","publish_time":1755876660178,"_cnpm_publish_time":1755876660178,"dist-tags":{"latest":"2.0.1"}}