{"id":16133954,"url":"https://github.com/noah2610/cmus-status-line","last_synced_at":"2025-03-18T15:31:10.101Z","repository":{"id":57606912,"uuid":"223770642","full_name":"Noah2610/cmus-status-line","owner":"Noah2610","description":"Prints configurable info about the current playback status of cmus using cmus-remote","archived":false,"fork":false,"pushed_at":"2020-07-06T01:03:20.000Z","size":93,"stargazers_count":7,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T21:21:24.794Z","etag":null,"topics":["cli","cmus","cmus-status"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/cmus-status-line","language":"Rust","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/Noah2610.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}},"created_at":"2019-11-24T16:01:22.000Z","updated_at":"2024-01-16T15:46:18.000Z","dependencies_parsed_at":"2022-08-30T08:51:10.323Z","dependency_job_id":null,"html_url":"https://github.com/Noah2610/cmus-status-line","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Noah2610%2Fcmus-status-line","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Noah2610%2Fcmus-status-line/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Noah2610%2Fcmus-status-line/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Noah2610%2Fcmus-status-line/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Noah2610","download_url":"https://codeload.github.com/Noah2610/cmus-status-line/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244249188,"owners_count":20422921,"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":["cli","cmus","cmus-status"],"created_at":"2024-10-09T22:46:45.638Z","updated_at":"2025-03-18T15:31:09.799Z","avatar_url":"https://github.com/Noah2610.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cmus-status-line\n\u003cdetails\u003e\n\u003csummary\u003e\n    Table of Contents\n\u003c/summary\u003e\n\n- [Description](#description)\n- [Installation](#installation)\n  - [Binaries](#binaries)\n  - [Install from crates.io](#install-from-cratesio)\n- [Usage](#usage)\n- [Configuration](#configuration)\n  - [Simple configuration example](#simple-configuration-example)\n  - [The `format` key](#the-format-key)\n  - [`FormatPart`](#formatpart)\n  - [`FormatExpression`](#formatexpression)\n- [License](#license)\n\n---\n\u003c/details\u003e\n\n## Description\nPrints the current `cmus` playback status in a customizable format to stdout.  \nExample output with default config:\n```\n$ cmus-status-line # When PLAYING\n Undertale - Megalovania  \u003c###-----\u003e\n\n$ cmus-status-line # When PAUSED\n Underta... \u003c#--\u003e\n```\n\n## Installation\n### Binaries\nBinaries for __Linux__ and __Windows__ are available from the [GitHub releases][releases] page.  \n__Note:__ Windows binaries are not tested, if there is any problem please let me know by opening an issue!\n\n### Install from [crates.io]\n```\ncargo install cmus-status-line\n```\n\n## Usage\nSimply run the command without any arguments  \nto get the formatted cmus playback status:\n```\n$ cmus-status-line\n Undertale - Megalovania  \u003c###-----\u003e\n```\n\nFor more details, see `cmus-status-line --help`:\n```\nPrints cmus playback information in a configurable format to stdout\n\nUSAGE:\n    cmus-status-line [OPTIONS] [COMMAND]\n\nOPTIONS:\n    -h, --help       Print this help message and exit.\n    -v, --version    Print version information and exit.\n\nCOMMANDS:\n    status\n        Print the current cmus playback status\n        with the format configured in the config.toml file.\n        This is the default command, so you may omit this argument.\n    dump-config\n        Print the default config as TOML to stdout.\n        To write the default config to the proper config file, run something like:\n            mkdir -p ~/.config/cmus-status-line\n            cmus-status-line dump-config \u003e ~/.config/cmus-status-line/config.toml\n    help\n        Print this help message and exit.\n```\n\n## Configuration\nThe goal for this project, was to make the status line's format highly configurable.  \nYou can configure the format as a string in the `config.toml` file.  \nTo get started, run the following to dump the default config to the proper config directory:  \n(This assumes you are on Linux, for Windows or MacOS find your appropriate config directory here:  \nhttps://docs.rs/dirs/2.0.2/dirs/fn.config_dir.html)\n```\nmkdir -p ~/.config/cmus-status-line\ncmus-status-line dump-config \u003e ~/.config/cmus-status-line/config.toml\n```\n\nThe default configuration is in the [`config.toml`][default_config] file.\n\n### Simple configuration example\nHere's a small and simple configuration example to get you started,  \nif you don't want to / don't have the time to read the details:\n```\nformat = \"\"\"\n%{Title} - %{ProgressBar(\"\u003c####----\u003e\")}\n\"\"\"\n```\n\n### The `format` key\nThe configuration has a `format` key, which is a string.  \n\nAny plain text in the string is simply printed in the format,  \nso a `format` string with this value:\n```\nformat = \"my cmus status!\"\n```\nwould simply print `my cmus status!`.  \nAny new-line characters are ignored.  \nTo add dynamic content, you can use the `%{...}` syntax to inject information,  \nfor example:\n```\nformat = \"playing song: %{Title}\"\n```\nwould replace the `%{Title}` part with the currently playing song's title.  \nWe call the `Title` part a `FormatPart`.\n\n### `FormatPart`\n[`enum FormatPart`](https://github.com/Noah2610/cmus-status-line/blob/master/src/cmus_status/output/format/format_part.rs#L8)  \nAny of the following format parts can be used  \nin the `format` string inside `%{...}` blocks.  \nThey will be replaced with a string value.\n\n- __`Text(String)`__  \n  Returns the given string.\n\n- __`Title`__  \n  Returns the currently playing song's title.  \n  Any underscores (`_`) will be replaced with spaces (` `).\n\n- __`Status`__  \n  Returns the current playback status (`CmusPlaybackStatus`),  \n  which can be one of:\n    - `Playing`\n    - `Paused`\n    - `Stopped`\n\n- __`Tag(String)`__\n  Returns the _tag_ meta value for the given tag name  \n  (such as \"artist\", \"album\", \"tracknumber\").  \n  Returns nothing if the tag doesn't exist.\n\n  Example: `Tag(\"artist\")`\n\n- __`Truncate(FormatPart, usize)`__  \n  Returns the wrapped `FormatPart`'s return string,  \n  truncated to the given `usize` length.  \n\n  Example: `Truncate(Title, 20)`  \n  which will return the full title of the song,  \n  if it has less than or exactly `20` characters.  \n  If it has less, the title will be truncated to `20` characters,  \n  with trailing `...` characters.\n\n- __`HtmlEscape(FormatPart)`__  \n  Uses the [`htmlescape::encode_minimal`][htmlescape_encode_minimal] function, to escape  \n  any HTML syntax such as `\u003c\u003e\u0026` from the wrapped `FormatPart`.  \n\n  Example: `HtmlEscape(Title)`\n\n- __`ProgressBar(String)`__  \n  Returns a progress bar for the playback of the currently playing song.  \n  The given string acts as a config for which characters to use.  \n  The first and last characters of the string are used as the boundary characters of the bar.  \n  The second and second to last characters are used as the _full_ and _empty_ characters.  \n  The total length of the string is the length of the progress bar.  \n\n  Example: `ProgressBar(\"\u003c##--\u003e\")` will use `\u003c\u003e` as the bar boundary characters,  \n  the `#` as the _full_ character, and the `-` as the _empty_ character.  \n  The progress bar will have a length of `6` characters.\n\n- __`Container(Vec\u003cFormatPart\u003e)`__  \n  This wraps multiple `FormatPart`s into a single one.  \n  Useful in combination with other `FormatPart`s.  \n\n  Example:\n  ```\n  Truncate(Container([\n      Text(\"progress: \"),\n      ProgressBar(\"\u003c##--\u003e\"),\n      Text(\" title: \"),\n      Title,\n  ]), 60)\n  ```\n  which will truncate the combined length of the bar,  \n  the song title, and some static text to 60 characters or less.\n\n- __`If(FormatExpression, FormatPart)`__  \n  Returns the evaluated `FormatPart`, if the `FormatExpression` returns `true`.  \n  See the section on `FormatExpression` for available expressions.  \n\n  Example:\n  ```\n  Container([\n      If(\n          IsStatus(Playing),\n          Title,\n      ),\n      If(\n          IsStatus(Paused),\n          Text(\"PAUSED\"),\n      ),\n  ])\n  ```\n\n- __`IfElse(FormatExpression, FormatPart, FormatPart)`__  \n  If the given `FormatExpression` returns `true`, then  \n  returns the _first_ `FormatPart`, otherwise returns the _second_ `FormatPart`.\n\n  Example:\n  ```\n  Container([\n      IfElse(\n          IsStatus(Playing),\n          Title,\n          Text(\"not playing\"),\n      ),\n  ])\n  ```\n\n### `FormatExpression`\n[`enum FormatExpression`](https://github.com/Noah2610/cmus-status-line/blob/master/src/cmus_status/output/format/format_expression.rs#L4)  \nA `FormatExpression` can be used as the first argument to  \n`If` `FormatPart`s. They will always evaluate to either `true` or `false`.\n\n- __`True`__  \n  Always returns `true`.\n\n- __`False`__  \n  Always returns `false`.\n\n- __`And(FormatExpression, FormatExpression)`__  \n  Returns `true` if both of the given `FormatExpression`s evaluate to `true`.\n\n- __`Or(FormatExpression, FormatExpression)`__  \n  Returns `true` if either of the given `FormatExpression`s evaluate to `true`.\n\n- __`Not(FormatExpression)`__  \n  Inverts the given expression.\n\n- __`IsStatus(CmusPlaybackStatus)`__  \n  Returns `true` if the given `CmusPlaybackStatus`  \n  is the currently playing song's status.\n  `CmusPlaybackStatus` can be one of:\n    - `Playing`\n    - `Paused`\n    - `Stopped`\n\n  Example:\n  ```\n  If(\n      IsStatus(Playing),\n      Container([\n          Text(\"playing song: \"),\n          Title,\n      ]),\n  ),\n  ```\n\n- __`HasTag(String)`__  \n  Returns `true` if the given tag name is set for the current track.\n  Returns `false` if the tag doesn't exist on the track.\n\n---\n\n## License\nDistributed under the terms of the [MIT license][license].\n\n[releases]:                  https://github.com/Noah2610/cmus-status-line/releases\n[default_config]:            https://github.com/Noah2610/cmus-status-line/blob/master/config.toml\n[crates.io]:                 https://crates.io/crates/cmus-status-line\n[htmlescape_encode_minimal]: https://docs.rs/htmlescape/0.3.1/htmlescape/fn.encode_minimal.html\n[license]:                   https://github.com/Noah2610/cmus-status-line/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoah2610%2Fcmus-status-line","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoah2610%2Fcmus-status-line","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoah2610%2Fcmus-status-line/lists"}