Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1<img width="945" alt="2017-07-26 9 27 05" src="https://user-images.githubusercontent.com/8784712/28623641-373450f4-7249-11e7-854d-1b076dab274d.png">2 3[](https://npmjs.com/package/cac) [](https://npmjs.com/package/cac) [](https://circleci.com/gh/cacjs/cac/tree/master) [](https://codecov.io/gh/cacjs/cac) [](https://github.com/egoist/donate) [](https://chat.egoist.moe) [](https://packagephobia.now.sh/result?p=cac)4 5## Introduction6 7**C**ommand **A**nd **C**onquer is a JavaScript library for building CLI apps.8 9## Features10 11- **Super light-weight**: No dependency, just a single file.12- **Easy to learn**. There're only 4 APIs you need to learn for building simple CLIs: `cli.option` `cli.version` `cli.help` `cli.parse`.13- **Yet so powerful**. Enable features like default command, git-like subcommands, validation for required arguments and options, variadic arguments, dot-nested options, automated help message generation and so on.14- **Developer friendly**. Written in TypeScript.15 16## Table of Contents17 18<!-- toc -->19 20- [Install](#install)21- [Usage](#usage)22 - [Simple Parsing](#simple-parsing)23 - [Display Help Message and Version](#display-help-message-and-version)24 - [Command-specific Options](#command-specific-options)25 - [Dash in option names](#dash-in-option-names)26 - [Brackets](#brackets)27 - [Negated Options](#negated-options)28 - [Variadic Arguments](#variadic-arguments)29 - [Dot-nested Options](#dot-nested-options)30 - [Default Command](#default-command)31 - [Supply an array as option value](#supply-an-array-as-option-value)32 - [Error Handling](#error-handling)33 - [With TypeScript](#with-typescript)34 - [With Deno](#with-deno)35- [Projects Using CAC](#projects-using-cac)36- [References](#references)37 - [CLI Instance](#cli-instance)38 - [cac(name?)](#cacname)39 - [cli.command(name, description, config?)](#clicommandname-description-config)40 - [cli.option(name, description, config?)](#clioptionname-description-config)41 - [cli.parse(argv?)](#cliparseargv)42 - [cli.version(version, customFlags?)](#cliversionversion-customflags)43 - [cli.help(callback?)](#clihelpcallback)44 - [cli.outputHelp()](#clioutputhelp)45 - [cli.usage(text)](#cliusagetext)46 - [Command Instance](#command-instance)47 - [command.option()](#commandoption)48 - [command.action(callback)](#commandactioncallback)49 - [command.alias(name)](#commandaliasname)50 - [command.allowUnknownOptions()](#commandallowunknownoptions)51 - [command.example(example)](#commandexampleexample)52 - [command.usage(text)](#commandusagetext)53 - [Events](#events)54- [FAQ](#faq)55 - [How is the name written and pronounced?](#how-is-the-name-written-and-pronounced)56 - [Why not use Commander.js?](#why-not-use-commanderjs)57- [Project Stats](#project-stats)58- [Contributing](#contributing)59- [Author](#author)60 61<!-- tocstop -->62 63## Install64 65```bash66yarn add cac67```68 69## Usage70 71### Simple Parsing72 73Use CAC as simple argument parser:74 75```js76// examples/basic-usage.js77const cli = require('cac')()78 79cli.option('--type <type>', 'Choose a project type', {80 default: 'node',81})82 83const parsed = cli.parse()84 85console.log(JSON.stringify(parsed, null, 2))86```87 88<img width="500" alt="2018-11-26 12 28 03" src="https://user-images.githubusercontent.com/8784712/48981576-2a871000-f112-11e8-8151-80f61e9b9908.png">89 90### Display Help Message and Version91 92```js93// examples/help.js94const cli = require('cac')()95 96cli.option('--type [type]', 'Choose a project type', {97 default: 'node',98})99cli.option('--name <name>', 'Provide your name')100 101cli.command('lint [...files]', 'Lint files').action((files, options) => {102 console.log(files, options)103})104 105// Display help message when `-h` or `--help` appears106cli.help()107// Display version number when `-v` or `--version` appears108// It's also used in help message109cli.version('0.0.0')110 111cli.parse()112```113 114<img width="500" alt="2018-11-25 8 21 14" src="https://user-images.githubusercontent.com/8784712/48979012-acb20d00-f0ef-11e8-9cc6-8ffca00ab78a.png">115 116### Command-specific Options117 118You can attach options to a command.119 120```js121const cli = require('cac')()122 123cli124 .command('rm <dir>', 'Remove a dir')125 .option('-r, --recursive', 'Remove recursively')126 .action((dir, options) => {127 console.log('remove ' + dir + (options.recursive ? ' recursively' : ''))128 })129 130cli.help()131 132cli.parse()133```134 135A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated. If you really want to use unknown options, use [`command.allowUnknownOptions`](#commandallowunknownoptions).136 137<img alt="command options" width="500" src="https://user-images.githubusercontent.com/8784712/49065552-49dc8500-f259-11e8-9c7b-a7c32d70920e.png">138 139### Dash in option names140 141Options in kebab-case should be referenced in camelCase in your code:142 143```js144cli145 .command('dev', 'Start dev server')146 .option('--clear-screen', 'Clear screen')147 .action((options) => {148 console.log(options.clearScreen)149 })150```151 152In fact `--clear-screen` and `--clearScreen` are both mapped to `options.clearScreen`.153 154### Brackets155 156When using brackets in command name, angled brackets indicate required command arguments, while square bracket indicate optional arguments.157 158When using brackets in option name, angled brackets indicate that a string / number value is required, while square bracket indicate that the value can also be `true`.159 160```js161const cli = require('cac')()162 163cli164 .command('deploy <folder>', 'Deploy a folder to AWS')165 .option('--scale [level]', 'Scaling level')166 .action((folder, options) => {167 // ...168 })169 170cli171 .command('build [project]', 'Build a project')172 .option('--out <dir>', 'Output directory')173 .action((folder, options) => {174 // ...175 })176 177cli.parse()178```179 180### Negated Options181 182To allow an option whose value is `false`, you need to manually specify a negated option:183 184```js185cli186 .command('build [project]', 'Build a project')187 .option('--no-config', 'Disable config file')188 .option('--config <path>', 'Use a custom config file')189```190 191This will let CAC set the default value of `config` to true, and you can use `--no-config` flag to set it to `false`.192 193### Variadic Arguments194 195The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to add `...` to the start of argument name, just like the rest operator in JavaScript. Here is an example:196 197```js198const cli = require('cac')()199 200cli201 .command('build <entry> [...otherFiles]', 'Build your app')202 .option('--foo', 'Foo option')203 .action((entry, otherFiles, options) => {204 console.log(entry)205 console.log(otherFiles)206 console.log(options)207 })208 209cli.help()210 211cli.parse()212```213 214<img width="500" alt="2018-11-25 8 25 30" src="https://user-images.githubusercontent.com/8784712/48979056-47125080-f0f0-11e8-9d8f-3219e0beb0ed.png">215 216### Dot-nested Options217 218Dot-nested options will be merged into a single option.219 220```js221const cli = require('cac')()222 223cli224 .command('build', 'desc')225 .option('--env <env>', 'Set envs')226 .example('--env.API_SECRET xxx')227 .action((options) => {228 console.log(options)229 })230 231cli.help()232 233cli.parse()234```235 236<img width="500" alt="2018-11-25 9 37 53" src="https://user-images.githubusercontent.com/8784712/48979771-6ada9400-f0fa-11e8-8192-e541b2cfd9da.png">237 238### Default Command239 240Register a command that will be used when no other command is matched.241 242```js243const cli = require('cac')()244 245cli246 // Simply omit the command name, just brackets247 .command('[...files]', 'Build files')248 .option('--minimize', 'Minimize output')249 .action((files, options) => {250 console.log(files)251 console.log(options.minimize)252 })253 254cli.parse()255```256 257### Supply an array as option value258 259```bash260node cli.js --include project-a261# The parsed options will be:262# { include: 'project-a' }263 264node cli.js --include project-a --include project-b265# The parsed options will be:266# { include: ['project-a', 'project-b'] }267```268 269### Error Handling270 271To handle command errors globally:272 273```js274try {275 // Parse CLI args without running the command276 cli.parse(process.argv, { run: false })277 // Run the command yourself278 // You only need `await` when your command action returns a Promise279 await cli.runMatchedCommand()280} catch (error) {281 // Handle error here..282 // e.g.283 // console.error(error.stack)284 // process.exit(1)285}286```287 288### With TypeScript289 290First you need `@types/node` to be installed as a dev dependency in your project:291 292```bash293yarn add @types/node --dev294```295 296Then everything just works out of the box:297 298```js299const { cac } = require('cac')300// OR ES modules301import { cac } from 'cac'302```303 304### With Deno305 306```ts307import { cac } from 'https://unpkg.com/cac/mod.ts'308 309const cli = cac('my-program')310```311 312## Projects Using CAC313 314Projects that use **CAC**:315 316- [VuePress](https://github.com/vuejs/vuepress): :memo: Minimalistic Vue-powered static site generator.317- [SAO](https://github.com/egoist/sao): ⚔️ Futuristic scaffolding tool.318- [DocPad](https://github.com/docpad/docpad): 🏹 Powerful Static Site Generator.319- [Poi](https://github.com/egoist/poi): ⚡️ Delightful web development.320- [bili](https://github.com/egoist/bili): 🥂 Schweizer Armeemesser for bundling JavaScript libraries.321- [Lad](https://github.com/ladjs/lad): 👦 Lad scaffolds a Koa webapp and API framework for Node.js.322- [Lass](https://github.com/lassjs/lass): 💁🏻 Scaffold a modern package boilerplate for Node.js.323- [Foy](https://github.com/zaaack/foy): 🏗 A lightweight and modern task runner and build tool for general purpose.324- [Vuese](https://github.com/vuese/vuese): 🤗 One-stop solution for vue component documentation.325- [NUT](https://github.com/nut-project/nut): 🌰 A framework born for microfrontends326- Feel free to add yours here...327 328## References329 330**💁 Check out [the generated docs](https://cac-api-doc.egoist.sh/classes/_cac_.cac.html) from source code if you want a more in-depth API references.**331 332Below is a brief overview.333 334### CLI Instance335 336CLI instance is created by invoking the `cac` function:337 338```js339const cac = require('cac')340const cli = cac()341```342 343#### cac(name?)344 345Create a CLI instance, optionally specify the program name which will be used to display in help and version message. When not set we use the basename of `argv[1]`.346 347#### cli.command(name, description, config?)348 349- Type: `(name: string, description: string) => Command`350 351Create a command instance.352 353The option also accepts a third argument `config` for additional command config:354 355- `config.allowUnknownOptions`: `boolean` Allow unknown options in this command.356- `config.ignoreOptionDefaultValue`: `boolean` Don't use the options's default value in parsed options, only display them in help message.357 358#### cli.option(name, description, config?)359 360- Type: `(name: string, description: string, config?: OptionConfig) => CLI`361 362Add a global option.363 364The option also accepts a third argument `config` for additional option config:365 366- `config.default`: Default value for the option.367- `config.type`: `any[]` When set to `[]`, the option value returns an array type. You can also use a conversion function such as `[String]`, which will invoke the option value with `String`.368 369#### cli.parse(argv?)370 371- Type: `(argv = process.argv) => ParsedArgv`372 373```ts374interface ParsedArgv {375 args: string[]376 options: {377 [k: string]: any378 }379}380```381 382When this method is called, `cli.rawArgs` `cli.args` `cli.options` `cli.matchedCommand` will also be available.383 384#### cli.version(version, customFlags?)385 386- Type: `(version: string, customFlags = '-v, --version') => CLI`387 388Output version number when `-v, --version` flag appears.389 390#### cli.help(callback?)391 392- Type: `(callback?: HelpCallback) => CLI`393 394Output help message when `-h, --help` flag appears.395 396Optional `callback` allows post-processing of help text before it is displayed:397 398```ts399type HelpCallback = (sections: HelpSection[]) => void400 401interface HelpSection {402 title?: string403 body: string404}405```406 407#### cli.outputHelp()408 409- Type: `() => CLI`410 411Output help message.412 413#### cli.usage(text)414 415- Type: `(text: string) => CLI`416 417Add a global usage text. This is not used by sub-commands.418 419### Command Instance420 421Command instance is created by invoking the `cli.command` method:422 423```js424const command = cli.command('build [...files]', 'Build given files')425```426 427#### command.option()428 429Basically the same as `cli.option` but this adds the option to specific command.430 431#### command.action(callback)432 433- Type: `(callback: ActionCallback) => Command`434 435Use a callback function as the command action when the command matches user inputs.436 437```ts438type ActionCallback = (439 // Parsed CLI args440 // The last arg will be an array if it's a variadic argument441 ...args: string | string[] | number | number[]442 // Parsed CLI options443 options: Options444) => any445 446interface Options {447 [k: string]: any448}449```450 451#### command.alias(name)452 453- Type: `(name: string) => Command`454 455Add an alias name to this command, the `name` here can't contain brackets.456 457#### command.allowUnknownOptions()458 459- Type: `() => Command`460 461Allow unknown options in this command, by default CAC will log an error when unknown options are used.462 463#### command.example(example)464 465- Type: `(example: CommandExample) => Command`466 467Add an example which will be displayed at the end of help message.468 469```ts470type CommandExample = ((name: string) => string) | string471```472 473#### command.usage(text)474 475- Type: `(text: string) => Command`476 477Add a usage text for this command.478 479### Events480 481Listen to commands:482 483```js484// Listen to the `foo` command485cli.on('command:foo', () => {486 // Do something487})488 489// Listen to the default command490cli.on('command:!', () => {491 // Do something492})493 494// Listen to unknown commands495cli.on('command:*', () => {496 console.error('Invalid command: %s', cli.args.join(' '))497 process.exit(1)498})499```500 501## FAQ502 503### How is the name written and pronounced?504 505CAC, or cac, pronounced `C-A-C`.506 507This project is dedicated to our lovely C.C. sama. Maybe CAC stands for C&C as well :P508 509<img src="http://i.giphy.com/v3FeH4swox9mg.gif" width="400"/>510 511### Why not use Commander.js?512 513CAC is very similar to Commander.js, while the latter does not support dot nested options, i.e. something like `--env.API_SECRET foo`. Besides, you can't use unknown options in Commander.js either.514 515_And maybe more..._516 517Basically I made CAC to fulfill my own needs for building CLI apps like [Poi](https://poi.js.org), [SAO](https://sao.vercel.app) and all my CLI apps. It's small, simple but powerful :P518 519## Project Stats520 521522 523## Contributing524 5251. Fork it!5262. Create your feature branch: `git checkout -b my-new-feature`5273. Commit your changes: `git commit -am 'Add some feature'`5284. Push to the branch: `git push origin my-new-feature`5295. Submit a pull request :D530 531## Author532 533**CAC** © [EGOIST](https://github.com/egoist), Released under the [MIT](./LICENSE) License.<br>534Authored and maintained by egoist with help from contributors ([list](https://github.com/cacjs/cac/contributors)).535 536> [Website](https://egoist.sh) · GitHub [@egoist](https://github.com/egoist) · Twitter [@\_egoistlily](https://twitter.com/_egoistlily)537 