{"id":13343235,"url":"https://github.com/cafehaine/xontrib-xlsd","last_synced_at":"2025-04-14T00:12:24.596Z","repository":{"id":41854877,"uuid":"291705253","full_name":"cafehaine/xontrib-xlsd","owner":"cafehaine","description":"xontrib-xlsd is the next gen ls command for xonsh shell, inspired by lsd.","archived":false,"fork":false,"pushed_at":"2023-08-11T08:13:55.000Z","size":159,"stargazers_count":22,"open_issues_count":6,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T00:12:07.961Z","etag":null,"topics":["emojis","ls","lsd","python","terminal","xonsh","xontrib"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cafehaine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-31T12:10:24.000Z","updated_at":"2025-04-03T04:37:01.000Z","dependencies_parsed_at":"2024-10-24T06:13:49.975Z","dependency_job_id":"384994ed-76de-49c8-a699-5c884772d06d","html_url":"https://github.com/cafehaine/xontrib-xlsd","commit_stats":{"total_commits":53,"total_committers":6,"mean_commits":8.833333333333334,"dds":0.3584905660377359,"last_synced_commit":"080e9b29008cbc30b091be10e3d3140e3d499290"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafehaine%2Fxontrib-xlsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafehaine%2Fxontrib-xlsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafehaine%2Fxontrib-xlsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafehaine%2Fxontrib-xlsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cafehaine","download_url":"https://codeload.github.com/cafehaine/xontrib-xlsd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799954,"owners_count":21163404,"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":["emojis","ls","lsd","python","terminal","xonsh","xontrib"],"created_at":"2024-07-29T19:30:42.846Z","updated_at":"2025-04-14T00:12:24.574Z","avatar_url":"https://github.com/cafehaine.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cb\u003exontrib-xlsd\u003c/b\u003e is the next gen ls command for \u003ca href=\"https://xon.sh\"\u003exonsh shell\u003c/a\u003e, inspired by \u003ca href=\"https://github.com/Peltoche/lsd\"\u003elsd\u003c/a\u003e.\n\u003c/p\u003e\n\n\u003ca href=\"https://github.com/cafehaine/xontrib-xlsd\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/cafehaine/xontrib-xlsd/master/assets/social-preview.png\" alt=\"Preview image\"\u003e\u003c/a\u003e\n\n\n## Contents\n\n1. [How to install xontrib-xlsd](#how-to-install-xontrib-xlsd)\n   - [Release version](#release-version)\n   - [From git (might be unstable)](#from-git-might-be-unstable)\n2. [Features](#features)\n3. [Customizing](#customizing)\n   - [Icons](#icons)\n      - [Registering an icon](#registering-an-icon)\n      - [Extension based icon source](#extension-based-icon-source)\n      - [Libmagic based icon source](#libmagic-based-icon-source)\n      - [Creating a custom icon source and changing the order](#creating-a-custom-icon-source-and-changing-the-order)\n   - [File order](#file-order)\n      - [Setting the file order](#setting-the-file-order)\n      - [Creating your own sort function](#creating-your-own-sort-function)\n   - [`-l` mode columns](#-l-mode-columns)\n      - [Changing the columns/the order](#changing-the-columnsthe-order)\n      - [Writing your own column](#writing-your-own-column)\n   - [Colors](#colors)\n   - [Item name](#item-name)\n\n# How to install xontrib-xlsd\n\n## Release version\n\nInstall the xontrib\n\n```bash\nxpip install xontrib-xlsd\n```\n\nAnd load it in your `.xonshrc`:\n\n```\nxontrib load xlsd\n```\n\n## From git (might be unstable)\n\n```bash\nxpip install git+https://github.com/cafehaine/xontrib-xlsd\n```\n\nAnd load it in your `.xonshrc`:\n\n```\nxontrib load xlsd\n```\n\n# Features\n\n- Emojis\n- Colors\n- A `tree`-like display when called recursively\n- Customizable\n- Written in python so it doesn't need to run a separate binary\n\n# Customizing\n\n## Icons\n\n### Registering an icon\n\nIn xlsd, icons are registered using a name. The name is then used by the different rules to get an icon for an `PathEntry`.\n\nYou can view the built-in icons in [xlsd/icons.py](xlsd/icons.py#L99).\n\nHere is how to add an icon (for example a rainbow). Put this in your `.xonshrc`\n\n```python\nimport xlsd.icons\n\nxlsd.icons.LS_ICONS.add('rainbow', \"🌈\")\n```\n\nIcon sources can now use your fancy icon.\n\nYou can also override built-in icons this way.\n\n### Extension based icon source\n\nThe extension based rules are the fastest to run, and thus are the prefered way of setting icons.\n\nFor example, to use your previously defined rainbow icon as the icon for `.txt` files, you can add the following snippet in your `.xonshrc`:\n\n```python\nimport xlsd.icons\n\nxlsd.icons.EXTENSION_ICONS.insert(0, ({'txt'}, 'rainbow'))\n```\n\n### Libmagic based icon source\n\n*IMPORTANT NOTE*: This source seems to only work on Arch Linux systems at the moment.\n\nThe libmagic (used by the `file` command on \\*nix) based rules are slower, but allow getting *an* icon when no extension matched.\n\nFor example, here we're going to use the xonsh icon for all folders. Add the following snippet in your `.xonshrc`:\n\n```python\nimport xlsd.icons\n\nxlsd.icons.MIMETYPE_ICONS.insert(0, (\"inode/directory\", 'xonsh'))\n```\n\nNote that this won't work unless you set the icon source order with libmagic as the first source, since the extension source already defines an icon for directory entries.\n\n### Creating a custom icon source and changing the order\n\nThe following snipped registers a new icon source (that simply returns the xonsh icon for everything), and makes it the first checked source. Put this in your `.xonshrc`.\n\n```python\n@xlsd_register_icon_source('my_source')\ndef my_icon_source(direntry):\n    return 'xonsh'\n\n$XLSD_ICON_SOURCES = ['my_source', 'extension', 'libmagic']\n```\n\n## File order\n\n### Setting the file order\n\nIn your `.xonshrc`, define a `$XLSD_SORT_METHOD` environment variable with one of the following values:\n\n- `\"directories_first\"`: The default: alphabetical order, with directories first\n- `\"alphabetical\"`: Simple alphabetical order\n- `\"as_is\"`: The default order of your OS.\n\n### Creating your own sort function\n\nYou can create a simple alphabetical (case sensitive) sort function with the snippet:\n\n```python\nimport xlsd\n\n@xlsd.xlsd_register_sort_method('alpha_case_sensitive')\ndef my_sort_method(entries):\n    entries.sort(key=lambda e: e.name)\n    return entries\n```\n\n## `-l` mode columns\n\n### Changing the columns/the order\n\nIn your `.xonshrc`, define a `$XLSD_LIST_COLUMNS` environment variable and set it's value to your desires.\n\nThe default value (similar to coreutil's `ls`) is the following:\n```bash\n$XLSD_LIST_COLUMNS = ['mode', 'hardlinks', 'uid', 'gid', 'size', 'mtime', 'name']\n```\n\nAll the built-in columns are used in this config.\n\n### Writing your own column\n\nA column is a function taking for only argument an `PathEntry` and that outputs a string.\n\nA simple filename column could be registered like this:\n```python\n@xlsd_register_column('filename', ColumnAlignment.LEFT)\ndef _xlsd_column_filename(direntry):\n    return direntry.name\n```\n\n## Colors\n\nThere are multiple colors/text effects that you can change in xlsd.\n\nThe full list of used colors is available in [xlsd/\\_\\_init\\_\\_.py](xlsd/__init__.py#L4).\n\nHere is a small example: we're going to make the size unit in -l mode appear red.\n\n```python\nimport xlsd\n\nxlsd.COLORS['size_unit'] = '{INTENSE_RED}'\n```\n\nYou can use any valid xonsh color.\n\nFor a quick list of colors/text effects, check out the [xonsh tutorial on colors](https://xon.sh/tutorial.html#customizing-the-prompt).\n\n## Item Name\n\nBy default, xlsd prints the item name with `{icon} {name}` format. You can update the `$XLSD_NAME_FORMAT` environment variable to change the format of the item. For example `$XLSD_NAME_FORMAT={icon}{name}` will remove the single space between icon \u0026 name.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafehaine%2Fxontrib-xlsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcafehaine%2Fxontrib-xlsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafehaine%2Fxontrib-xlsd/lists"}