# Cobra vs urfave/cli: source lines of code compared

The Cobra vs urfave/cli comparison on OctoCounts shows side-by-side source line counts for spf13/cobra and urfave/cli, counted with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-08-26, spf13/cobra contains 17,133 total lines (11,516 code) across 44 files, while urfave/cli contains 29,665 total lines (21,615 code) across 83 files as of 2026-08-26. urfave/cli is about 1.9x the size of spf13/cobra by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [spf13/cobra](https://octocounts.com/github/spf13/cobra) | [urfave/cli](https://octocounts.com/github/urfave/cli) |
| --- | ---: | ---: |
| Files | 44 | 83 |
| Total lines | 17,133 | 29,665 |
| Code lines | 11,516 | 21,615 |
| Comment lines | 2,917 | 3,882 |
| Blank lines | 2,700 | 4,168 |
| Languages counted | 4 | 7 |

Top languages in spf13/cobra: Go (99.8% of code), Makefile (0.2% of code), Markdown (0.0% of code). Top languages in urfave/cli: Go (99.1% of code), YAML (0.6% of code), Fish (0.2% of code). Go, Makefile appear in both top language lists; Markdown, Plain Text appear only in spf13/cobra's top languages; YAML, Fish, PowerShell appear only in urfave/cli's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. spf13/cobra was counted at ref main (commit adbc8813901b) on 2026-08-26; urfave/cli was counted at ref main (commit 1a4deb4f5a35) on 2026-08-26. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

spf13/cobra counts the Cobra repository: a library for building command-line applications in Go, including its generators and documentation. urfave/cli counts the urfave/cli repository: a Go library for the same purpose — defining commands, flags, and subcommands. Both are single-purpose Go libraries, making this a relatively like-for-like comparison, counted on the dates shown above.

Both repositories are Go codebases, and the per-language tables show Go dominating both counts — two libraries in the same language addressing the same task of CLI construction.

Each library's repository also carries its documentation and code-generation or helper material alongside the core package, so both counts include supporting content beyond the library code an application imports.

_Repository size does not indicate which library is more capable or more suitable; both expose similar command-and-flag abstractions, and the choice between them is a matter of API preference and existing ecosystem, not of line count._

Sources: [spf13/cobra repository](https://github.com/spf13/cobra) · [urfave/cli repository](https://github.com/urfave/cli). Statements verified 2026-09-16.

Evidence and next steps:

- [spf13/cobra SLOC report](https://octocounts.com/github/spf13/cobra)
- [urfave/cli SLOC report](https://octocounts.com/github/urfave/cli)
- [Compare spf13/cobra and urfave/cli interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Fspf13%2Fcobra&right=https%3A%2F%2Fgithub.com%2Furfave%2Fcli)

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

## Compare FAQ

### Which has more lines of code, spf13/cobra or urfave/cli?

urfave/cli has more code: 21,615 code lines versus 11,516 for spf13/cobra, about 1.9x as much, based on cached OctoCounts reports as of 2026-08-26.

### Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for spf13/cobra, urfave/cli, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. spf13/cobra was counted at ref main (commit adbc8813901b) on 2026-08-26; urfave/cli was counted at ref main (commit 1a4deb4f5a35) on 2026-08-26. See the counting methodology for ignored directories and analysis options.

### Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
