{"id":16529091,"url":"https://github.com/svengreb/nib","last_synced_at":"2026-06-05T06:31:22.660Z","repository":{"id":40429754,"uuid":"290023418","full_name":"svengreb/nib","owner":"svengreb","description":"A “stylish“, log-level based line printer for human-facing Go CLI applications.","archived":false,"fork":false,"pushed_at":"2022-05-09T10:20:25.000Z","size":591,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T06:30:57.509Z","etag":null,"topics":["cli","cli-writer","go","golang","hacktoberfest","lineprinter"],"latest_commit_sha":null,"homepage":"","language":"Go","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/svengreb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2020-08-24T19:40:30.000Z","updated_at":"2023-08-23T13:02:06.000Z","dependencies_parsed_at":"2022-08-09T20:10:44.358Z","dependency_job_id":null,"html_url":"https://github.com/svengreb/nib","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/svengreb/nib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svengreb%2Fnib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svengreb%2Fnib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svengreb%2Fnib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svengreb%2Fnib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svengreb","download_url":"https://codeload.github.com/svengreb/nib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svengreb%2Fnib/sbom","scorecard":{"id":861057,"data":{"date":"2025-08-11","repo":{"name":"github.com/svengreb/nib","commit":"4890bd0f634924ae6b823100a4c532f886883f11"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci-go.yaml:1","Warn: no topLevel permission defined: .github/workflows/ci-node.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-go.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-go.yaml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-go.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci-go.yaml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-go.yaml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-go.yaml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-go.yaml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-go.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-node.yaml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-node.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-node.yaml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/svengreb/nib/ci-node.yaml/main?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/svengreb/.github/security.md:1","Info: Found linked content: github.com/svengreb/.github/security.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/svengreb/.github/security.md:1","Info: Found text in security policy: github.com/svengreb/.github/security.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"32 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-2456 / GHSA-449p-3h89-pw88","Warn: Project is vulnerable to: GO-2024-2466 / GHSA-mw99-9chc-xw7r","Warn: Project is vulnerable to: GO-2025-3367 / GHSA-r9px-m959-cxf4","Warn: Project is vulnerable to: GO-2025-3368 / GHSA-v725-9546-7q7m","Warn: Project is vulnerable to: GO-2021-0227 / GHSA-3vm4-22fp-5rfm","Warn: Project is vulnerable to: GO-2022-0968 / GHSA-gwc9-m7rh-j2ww","Warn: Project is vulnerable to: GO-2021-0356 / GHSA-8c26-wmh5-6g9v","Warn: Project is vulnerable to: GO-2024-2961","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2022-0236 / GHSA-h86h-8ppg-mxmh","Warn: Project is vulnerable to: GO-2021-0238 / GHSA-83g2-8m93-v3w7","Warn: Project is vulnerable to: GO-2022-0288","Warn: Project is vulnerable to: GO-2022-0969 / GHSA-69cg-p879-7622","Warn: Project is vulnerable to: GO-2022-1144 / GHSA-xrjj-mj9h-534m","Warn: Project is vulnerable to: GO-2023-1571 / GHSA-vvpx-j8f3-3w6h","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw","Warn: Project is vulnerable to: GO-2022-0493 / GHSA-p782-xgp4-8hr8","Warn: Project is vulnerable to: GO-2022-0603 / GHSA-hp87-p4gw-j4gq","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T01:16:25.329Z","repository_id":40429754,"created_at":"2025-08-24T01:16:25.329Z","updated_at":"2025-08-24T01:16:25.329Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33932048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","cli-writer","go","golang","hacktoberfest","lineprinter"],"created_at":"2024-10-11T17:43:07.592Z","updated_at":"2026-06-05T06:31:22.619Z","avatar_url":"https://github.com/svengreb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/svengreb/nib/main/assets/images/repository-hero.svg?sanitize=true\"/\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/svengreb/nib/releases/latest\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/svengreb/nib.svg?style=flat-square\u0026label=Release\u0026logo=github\u0026logoColor=eceff4\u0026colorA=4c566a\u0026colorB=88c0d0\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/svengreb/nib/blob/main/CHANGELOG.md\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/svengreb/nib.svg?style=flat-square\u0026label=Changelog\u0026logo=github\u0026logoColor=eceff4\u0026colorA=4c566a\u0026colorB=88c0d0\"/\u003e\u003c/a\u003e \u003ca href=\"https://pkg.go.dev/github.com/svengreb/nib\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/svengreb/nib.svg?style=flat-square\u0026label=GoDoc\u0026logo=go\u0026logoColor=eceff4\u0026colorA=4c566a\u0026colorB=88c0d0\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/svengreb/nib/actions?query=workflow%3Aci\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/svengreb/nib/ci.svg?style=flat-square\u0026label=CI\u0026logo=github\u0026logoColor=eceff4\u0026colorA=4c566a\"/\u003e\u003c/a\u003e \u003ca href=\"https://codecov.io/gh/svengreb/nib\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/codecov/c/github/svengreb/nib/main.svg?style=flat-square\u0026label=Coverage\u0026logo=codecov\u0026logoColor=eceff4\u0026colorA=4c566a\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://golang.org/doc/effective_go.html#formatting\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?style=flat-square\u0026label=Go%20Style%20Guide\u0026message=gofmt\u0026logo=go\u0026logoColor=eceff4\u0026colorA=4c566a\u0026colorB=88c0d0\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/arcticicestudio/styleguide-markdown/releases/latest\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/release/arcticicestudio/styleguide-markdown.svg?style=flat-square\u0026label=Markdown%20Style%20Guide\u0026logoColor=eceff4\u0026colorA=4c566a\u0026colorB=88c0d0\u0026logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzOSIgaGVpZ2h0PSIzOSIgdmlld0JveD0iMCAwIDM5IDM5Ij48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNEOERFRTkiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMS41IDEuNWgzNnYzNmgtMzZ6Ii8%2BPHBhdGggZmlsbD0iI0Q4REVFOSIgZD0iTTIwLjY4MyAyNS42NTVsNS44NzItMTMuNDhoLjU2Nmw1Ljg3MyAxMy40OGgtMS45OTZsLTQuMTU5LTEwLjA1Ni00LjE2MSAxMC4wNTZoLTEuOTk1em0tMi42OTYgMGwtMTMuNDgtNS44NzJ2LS41NjZsMTMuNDgtNS44NzJ2MS45OTVMNy45MzEgMTkuNWwxMC4wNTYgNC4xNnoiLz48L3N2Zz4%3D\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/arcticicestudio/styleguide-git/releases/latest\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/release/arcticicestudio/styleguide-git.svg?style=flat-square\u0026label=Git%20Style%20Guide\u0026logoColor=eceff4\u0026colorA=4c566a\u0026colorB=88c0d0\u0026logo=git\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eA “stylish“, log-level based line printer for human-facing \u003ca href=\"https://go.dev\" target=\"_blank\"\u003eGo\u003c/a\u003e CLI applications.\u003c/p\u003e\n\n## Features\n\nThe [`pencil` package][go-pkg-svengreb/nib/pencil] provides [`pencil.Pencil`][go-pkg-type-svengreb/nib/pencil#pencil] that implements [`nib.Nib`][go-pkg-type-svengreb/nib#nib] with\n\n- …custom prefixes\n- …configurable verbosity level icons\n\nThe [`inkpen` package][go-pkg-svengreb/nib/inkpen] composes `pencil.Pencil` and additionally provides…\n\n- …colored output\n- …automatic TTY and cross-platform terminal color support detection\n\nPlease note that this package has mainly been created for my personal use in mind to avoid copying source code between my CLI based projects that require a line printer for human-facing messages. The default configurations might not fit your needs, but the `pencil.Pencil` and `inkpen.Inkpen` implementations of the `nib.Nib` interface have been designed so that they can be flexibly adapted to different use cases and environments.\n\n## API\n\nThe [`nib` package][go-pkg-svengreb/nib] provides the currently latest API `v0`.\nThe [`nib.Nib` interface][go-pkg-type-svengreb/nib#nib] consists of six functions that allow to print a formatted message with different [verbosity levels][go-pkg-type-svengreb/nib#verbosity]:\n\n- `Compile(v Verbosity, format string, args ...interface{}) string` — compiles a message for the verbosity level using the given format and arguments..\n- `Debugf(format string, args ...interface{})` — writes a message with `debug` verbosity level for the given format and arguments.\n- `Errorf(format string, args ...interface{})` — writes a message with `error` verbosity level for the given format and arguments.\n- `Fatalf(format string, args ...interface{})` — writes a message with `fatal` verbosity level for the given format and arguments.\n- `Infof(format string, args ...interface{})` — writes a message with `info` verbosity level for the given format and arguments.\n- `Successf(format string, args ...interface{})` — writes a message with `success` verbosity level for the given format and arguments.\n- `Warnf(format string, args ...interface{})` — writes a message with `warn` verbosity level for the given format and arguments.\n- `Writer() io.Writer` — returns the underlying [`io.Writer`][go-doc-type-io#writer].\n\nThe [`pencil` package][go-pkg-svengreb/nib/pencil] implements this interface including [features like custom prefixes and verbosity level icons](#features).\nThe [`inkpen` package][go-pkg-svengreb/nib/inkpen] composes [`pencil.Pencil`][go-pkg-type-svengreb/nib/pencil#pencil] and additionally [comes with additional features like colored output including automatic TTY and cross-platform terminal color support detection](#features).\n\nFor more details about the API, available packages and types please see the [GoDoc reference documentation][go-pkg-svengreb/nib].\n\n## Usage\n\nIn addition to the possibility of implementing the [`nib.Nib` interface][go-pkg-type-svengreb/nib#nib] yourself the [`pencil.Pencil` type][go-pkg-type-svengreb/nib/pencil#pencil] can be used:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil\n\tpen := pencil.New()\n\t// ... or inkpen with default configurations where nib.InfoVerbosity is the default verbosity level.\n\tink := inkpen.New()\n\n\t// Print a message with \"info\" level.\n\tfruit := \"coconut\"\n\tpen.Infof(\"My favorite fruits are %ss\", fruit)\n\tink.Infof(\"My favorite fruits are %ss\", fruit)\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\n## Configuration\n\nBoth types [`pencil.Pencil`][go-pkg-type-svengreb/nib/pencil#pencil] and [`inkpen.Inkpen`][go-pkg-type-svengreb/nib/inkpen#inkpen] were designed so that they can be flexibly adapted to different use cases and environments.\n\nTo customize a `pencil.Pencil` the [`New` function][go-pkg-func-svengreb/nib/pencil#new] accepts one or more [`pencil.Option`][go-pkg-type-svengreb/nib/pencil#option].\nA `inkpen.Inkpen` can also be customized with one or more `pencil.Option` by passing them to the [`inkpen.WithPencilOptions(pencilOpts ...pencil.Option) Option` function][go-pkg-met-svengreb/nib/inkpen#eithpenciloptions] via the [`New` function][go-pkg-func-svengreb/nib/inkpen#new].\n\n### Verbosity\n\nThe default verbosity level of `pencil.Pencil` is [`nib.InfoVerbosity`][go-pkg-var-svengreb/nib#infoverbosity] that prints messages with “info“ scope.\nYou can adjust it to any other level through the [`pencil.WithVerbosity(v nib.Verbosity) Option`][go-pkg-met-svengreb/nib/pencil#withverbosity] function:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"github.com/svengreb/nib\"\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil...\n\tpen := pencil.New(pencil.WithVerbosity(nib.DebugVerbosity))\n\t// ...or inkpen with default configurations and set the verbosity level from \"info\" to \"debug\" scope.\n\tink := inkpen.New(inkpen.WithPencilOptions(pencil.WithVerbosity(nib.DebugVerbosity)))\n\n\tpen.Debugf(\"Raspberries are my second favorite fruit\")\n\tink.Debugf(\"Raspberries are my second favorite fruit\")\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\nNote that [`nib.Verbosity`][go-pkg-type-svengreb/nib#verbosity] implements [`encoding.TextUnmarshaler`][go-doc-encoding#textnnmarshaler] to allow to unmarshal a textual representation of the level or get the `nib.Verbosity` based on the level scope name:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/svengreb/nib\"\n)\n\nfunc main() {\n\t// Get the textual representation of the verbosity level.\n\tfmt.Println(nib.InfoVerbosity.String()) // \"info\"\n\n\t// Get the nib.Verbosity from the given verbosity level scope name.\n\t// The function returns an non-nil error when the given name is not valid.\n\tv, err := nib.ParseVerbosity(\"error\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tfmt.Printf(\"Verbosity: %s\\n\", v.String()) // \"error\"\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\nTo check whether the verbosity level is enabled, the [`*pencil.Pencil.Enabled(v nib.Verbosity) bool`][go-pkg-met-svengreb/nib/pencil#enabled] or [`*inkpen.Inkpen.Enabled(v nib.Verbosity) bool`][go-pkg-met-svengreb/nib/inkpen#enabled] methods can be used:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/svengreb/nib\"\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil\n\tpen := pencil.New()\n\t// ... or inkpen...\n\tink := inkpen.New()\n\n\t// ...and check whether the verbosity level is enabled.\n\tfmt.Println(pen.Enabled(nib.DebugVerbosity)) // false\n\tfmt.Println(pen.Enabled(nib.ErrorVerbosity)) // true\n\tfmt.Println(ink.Enabled(nib.FatalVerbosity)) // true\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\n### Icons\n\nThe default icons are [Unicode characters][wikip-unicode] which are supported by almost all terminals nowadays, but there might be cases where you want to use simple [ASCII characters][wikip-ascii] instead.\nYou can change any verbosity level icon through the [`pencil.WithIcons(icons map[nib.Verbosity]rune) Option`][go-pkg-met-svengreb/nib/pencil#withicons] function:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"github.com/svengreb/nib\"\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil...\n\tpen := pencil.New(pencil.WithIcons(map[nib.Verbosity]rune{nib.InfoVerbosity: '\u003e'}))\n\t// ...or inkpen, that uses Unicode characters as verbosity level icons by default, and change the icon for the \"info\"\n\t// verbosity level scope.\n\tink := inkpen.New(inkpen.WithPencilOptions(\n\t\tpencil.WithIcons(map[nib.Verbosity]rune{nib.InfoVerbosity: '\u003e'}),\n\t))\n\n\tpen.Infof(\"Cashew nuts can be combined very well with yogurt\")\n\tink.Infof(\"Cashew nuts can be combined very well with yogurt\")\n}\n\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\n`inkpen.Inkpen` allows to customize the color of icons through the [`inkpen.WithIconColorFuncs(iconColorFuncs map[nib.Verbosity]IconColorFunc) Option`][go-pkg-met-svengreb/nib/inkpen#withiconcolorfuncs] function:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"github.com/fatih/color\"\n\n\t\"github.com/svengreb/nib\"\n\t\"github.com/svengreb/nib/inkpen\"\n)\n\nfunc main() {\n\t// Create a new inkpen and change the color function for the \"info\" verbosity level scope to use green instead of\n\t// blue as foreground color.\n\tink := inkpen.New(inkpen.WithIconColorFuncs(map[nib.Verbosity]inkpen.IconColorFunc{\n\t\tnib.InfoVerbosity: color.New(color.FgGreen).Sprintf,\n\t}))\n\n\tink.Infof(\"Almonds taste very good with vanilla\")\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\nTo disable verbosity level icons to be printed at all use the [`pencil.UseIcons(useIcons bool) Option`][go-pkg-met-svengreb/nib/pencil#useicons] function:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil...\n\tpen := pencil.New(pencil.UseIcons(false))\n\t// ...or inkpen and disable all verbosity level icons.\n\tink := inkpen.New(inkpen.WithPencilOptions(pencil.UseIcons(false)))\n\n\tpen.Errorf(\"Cane sugar is not necessary for a delicious yogurt\")\n\tink.Errorf(\"Cane sugar is not necessary for a delicious yogurt\")\n}\n\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\nNote that the provided map of icons gets merged with the default map in order to ensure there are no missing icons.\nSee the [`pencil` package][go-pkg-svengreb/nib/pencil] to get an overview of the icon characters that are used by default.\n\nTo check if verbosity level icons are enabled, the [`*pencil.Pencil.IconsEnabled() bool`][go-pkg-met-svengreb/nib/pencil#iconsenabled] or [`*inkpen.Inkpen.IconsEnabled() bool`][go-pkg-met-svengreb/nib/inkpen#iconsenabled] methods can be used:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil...\n\tpen := pencil.New()\n\t// ...and check whether verbosity level icons are enabled.\n\tfmt.Println(pen.IconsEnabled()) // true\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\n### Prefixes\n\nBy default only the verbosity level icons are printed as prefix before the given message format and arguments.\nYou can add any amount of custom prefixes through the [`pencil.WithPrefixes(prefixes ...string) Option`][go-pkg-met-svengreb/nib/pencil#withprefixes] function:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil...\n\tpen := pencil.New(pencil.WithPrefixes(\"[fruit mixer]\"))\n\t// ... or inkpen and add a custom prefix that gets placed before the actual message.\n\tink := inkpen.New(inkpen.WithPencilOptions(pencil.WithPrefixes(\"[fruit mixer]\")))\n\n\tpen.Infof(\"Strawberries are also a very tasty ingredient for low-fat quark\")\n\tink.Infof(\"Strawberries are also a very tasty ingredient for low-fat quark\")\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\n### Writer\n\nBy default `pencil.Pencil` uses [`os.Stderr`][go-doc-os#pkg_vars] while `inkpen.Inkpen` uses `color.Output` which in turn is a exported variable that makes use of [github.com/mattn/go-colorable][mattn/go-colorable], a package for colored TTY output on multiple platforms.\nYou can use any [`io.Writer`][go-doc-type-io#writer] through the [`pencil.WithWriter(writer io.Writer) Option`][go-pkg-met-svengreb/nib/pencil#withicons] function:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil...\n\tpen := pencil.New(pencil.WithWriter(os.Stderr))\n\t// ... or inkpen and change the output writer to use the OS error stream.\n\tink := inkpen.New(inkpen.WithPencilOptions(pencil.WithWriter(os.Stderr)))\n\n\tpen.Errorf(\"Blueberries mixed with raspberries and yoghurt are a delicious dream\")\n\tink.Errorf(\"Blueberries mixed with raspberries and yoghurt are a delicious dream\")\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\n\u003c!--lint ignore no-duplicate-headings--\u003e\n\n## Writer\n\nBoth types [`pencil.Pencil`][go-pkg-type-svengreb/nib/pencil#pencil] and [`inkpen.Inkpen`][go-pkg-type-svengreb/nib/inkpen#inkpen] use recommended [`io.Writer`][go-doc-type-io#writer] by default to provide optimal compatibility for their specific features like colored output.\nTo allow to either reuse the default or configured `io.Writer` the `Writer() io.Writer` method of the `nib.Nib` API interface can be used:\n\n\u003c!--lint disable no-tabs--\u003e\n\n```go\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/svengreb/nib/inkpen\"\n\t\"github.com/svengreb/nib/pencil\"\n)\n\nfunc main() {\n\t// Create a new pencil...\n\tpen := pencil.New(pencil.WithWriter(os.Stderr))\n\t// ... or inkpen.\n\tink := inkpen.New()\n\n\t_, _ = fmt.Fprintln(pen.Writer(), \"Brazil nuts are also a delicious and healthy snack between meals\")\n\t_, _ = fmt.Fprintln(ink.Writer(), \"Brazil nuts are also a delicious and healthy snack between meals\")\n}\n```\n\n\u003c!--lint enable no-tabs--\u003e\n\n## Contributing\n\n_nib_ is an open source project and contributions are always welcome!\n\nThere are many ways to contribute, from [writing- and improving documentation and tutorials][contrib-guide-docs], [reporting bugs][contrib-guide-bugs], [submitting enhancement suggestions][contrib-guide-enhance] that can be added to _nib_ by [submitting pull requests][contrib-guide-pr].\n\nPlease take a moment to read the [contributing guide][contrib-guide] to learn about the development process, the [styleguides][contrib-guide-styles] to which this project adheres as well as the [branch organization][contrib-guide-branching] and [versioning][contrib-guide-versioning] model.\n\nThe guide also includes information about [minimal, complete, and verifiable examples][contrib-guide-mcve] and other ways to contribute to the project like [improving existing issues][contrib-guide-impr-issues] and [giving feedback on issues and pull requests][contrib-guide-feedback].\n\n\u003cp align=\"center\"\u003eCopyright \u0026copy; 2019-present \u003ca href=\"https://www.svengreb.de\" target=\"_blank\"\u003eSven Greb\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/svengreb/nib/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/static/v1.svg?style=flat-square\u0026label=License\u0026message=MIT\u0026logoColor=eceff4\u0026logo=github\u0026colorA=4c566a\u0026colorB=88c0d0\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n[contrib-guide-branching]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#branch-organization\n[contrib-guide-bugs]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#bug-reports\n[contrib-guide-docs]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#documentations\n[contrib-guide-enhance]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#enhancement-suggestions\n[contrib-guide-feedback]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#give-feedback-on-issues-and-pull-requests\n[contrib-guide-impr-issues]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#improve-issues\n[contrib-guide-mcve]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#mcve\n[contrib-guide-pr]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#pull-requests\n[contrib-guide-styles]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#styleguides\n[contrib-guide-versioning]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md#versioning\n[contrib-guide]: https://github.com/svengreb/nib/blob/main/CONTRIBUTING.md\n[go-doc-encoding#textnnmarshaler]: https://golang.org/pkg/encoding/#TextUnmarshaler\n[go-doc-os#pkg_vars]: https://golang.org/pkg/os/#pkg-variables\n[go-doc-type-io#writer]: https://golang.org/pkg/io/#Writer\n[go-pkg-func-svengreb/nib/inkpen#new]: https://pkg.go.dev/github.com/svengreb/nib/inkpen#New\n[go-pkg-func-svengreb/nib/pencil#new]: https://pkg.go.dev/github.com/svengreb/nib/pencil#New\n[go-pkg-met-svengreb/nib/inkpen#eithpenciloptions]: https://pkg.go.dev/github.com/svengreb/nib/inkpen#Inkpen.WithPencilOptions\n[go-pkg-met-svengreb/nib/inkpen#enabled]: https://pkg.go.dev/github.com/svengreb/nib/inkpen#Inkpen.Enabled\n[go-pkg-met-svengreb/nib/inkpen#iconsenabled]: https://pkg.go.dev/github.com/svengreb/nib/inkpen#Inkpen.IconsEnabled\n[go-pkg-met-svengreb/nib/inkpen#withiconcolorfuncs]: https://pkg.go.dev/github.com/svengreb/nib/inkpen#Inkpen.WithIconColorFuncs\n[go-pkg-met-svengreb/nib/pencil#enabled]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Pencil.Enabled\n[go-pkg-met-svengreb/nib/pencil#iconsenabled]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Pencil.IconsEnabled\n[go-pkg-met-svengreb/nib/pencil#useicons]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Pencil.UseIcons\n[go-pkg-met-svengreb/nib/pencil#withicons]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Pencil.WithIcons\n[go-pkg-met-svengreb/nib/pencil#withprefixes]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Pencil.WithPrefixes\n[go-pkg-met-svengreb/nib/pencil#withverbosity]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Pencil.WithVerbosity\n[go-pkg-svengreb/nib]: https://pkg.go.dev/github.com/svengreb/nib\n[go-pkg-svengreb/nib/inkpen]: https://pkg.go.dev/github.com/svengreb/nib/inkpen\n[go-pkg-svengreb/nib/pencil]: https://pkg.go.dev/github.com/svengreb/nib/pencil\n[go-pkg-type-svengreb/nib/inkpen#inkpen]: https://pkg.go.dev/github.com/svengreb/nib/inkpen#Inkpen\n[go-pkg-type-svengreb/nib/pencil#option]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Option\n[go-pkg-type-svengreb/nib/pencil#pencil]: https://pkg.go.dev/github.com/svengreb/nib/pencil#Pencil\n[go-pkg-type-svengreb/nib#nib]: https://pkg.go.dev/github.com/svengreb/nib#Nib\n[go-pkg-type-svengreb/nib#verbosity]: https://pkg.go.dev/github.com/svengreb/nib#Verbosity\n[go-pkg-var-svengreb/nib#infoverbosity]: https://pkg.go.dev/github.com/svengreb/nib#InfoVerbosity\n[mattn/go-colorable]: https://github.com/mattn/go-colorable\n[wikip-ascii]: https://en.wikipedia.org/wiki/ASCII\n[wikip-unicode]: https://en.wikipedia.org/wiki/Unicode\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvengreb%2Fnib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvengreb%2Fnib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvengreb%2Fnib/lists"}