pls-rs / pls Goto Github PK
View Code? Open in Web Editor NEW`pls` is a prettier and powerful `ls(1)` for the pros.
Home Page: https://pls.cli.rs/
License: GNU General Public License v3.0
`pls` is a prettier and powerful `ls(1)` for the pros.
Home Page: https://pls.cli.rs/
License: GNU General Public License v3.0
Currently, there is not much documentation about the configuration file options, especially the app_const
and entry_const
options. Having a single page documenting all the options in the .pls.yaml
file would be extremely helpful.
In that vein, the link to https://pls-rs.github.io/pls/guides/conf/ is broken. The page does not exist, and results in an Error 404. It is linked from https://pls-rs.github.io/pls/guides/specs/#configuration.
I have omitted the other sections in the issue template as they do not pertain to this bug/issue.
Heard about this tool on the Python Bytes podcast. Thanks for building and sharing it, it looks super cool!
Reading the docs, it seems like icons are supposed to work out-of-the-box, but I instead just get blank spaces before the file names. The emojis work, but are not as pretty ๐
pipx install pls
If I run pls something
, and something
is not a directory, it crashes.
pls something
, where something
does not existI expected to see a concise error message, similar to the one ls
prints, e.g.:
ybxh061@C02YD4UEJG5H ~ % ls something
ls: something: No such file or directory
ybxh061@C02YD4UEJG5H ~ % pls something
Traceback (most recent call last):
File "/Users/ybxh061/.local/bin/pls", line 8, in <module>
sys.exit(main())
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/main.py", line 17, in main
globals.state.parse_args(None)
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/globals.py", line 63, in parse_args
parser.parse_args(argv, namespace=self)
File "/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/argparse.py", line 1825, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/argparse.py", line 1858, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/argparse.py", line 2070, in _parse_known_args
stop_index = consume_positionals(start_index)
File "/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/argparse.py", line 2026, in consume_positionals
take_action(action, args)
File "/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/argparse.py", line 1919, in take_action
argument_values = self._get_values(action, argument_strings)
File "/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/argparse.py", line 2450, in _get_values
value = self._get_value(action, arg_string)
File "/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/argparse.py", line 2483, in _get_value
result = type_func(arg_string)
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/arg_parser.py", line 49, in directory
raise ExecException(f"`directory` arg should be a valid directory: {path_str}")
pls.exceptions.ExecException: `directory` arg should be a valid directory: something
Forgive me for opening another issue so quickly! This is an excellent application, and I've been enjoying using it. I can't seem to find documentation about how to change the default directory icon or color.
I have tried an extension
node with an empty string, and a pattern
node which looks for \
or /
at the end of the name. Neither have worked, and without any examples in the documentation, I'm assuming this idea is not supported at the moment.
It would be very nice to be able to specify directories either by pattern
or extension
, or some other mechanism within .pls.yml
. This would allow the user to change the default directory color or icon.
What I am trying to do is match the color output of pls
to the color output of ls
, which uses the LS_COLORS environmental variable. pls
could make the default output colors use this variable, but it is not always set for users. On macOS, it is only used if the users use the GNU-based ls
, for example. I think a simpler solution would be to make it easier to change directory colors, and allow the user to input any other extensions or patterns they want. That part is already very simple thanks to the excellent config!
My apologies if this is already supported! I looked long and hard through the documentation but failed to find the solution to this.
When I run pls
on Windows (for a certain directory), I get a stack trace.
PowerShell
as an administrator, install gsudo, specifically via chocolatey:
$ choco install gsudo
pls
:
$ pls C:\tools\gsudo\
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\Scripts\pls.exe\__main__.py", line 7, in <module>
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\pls\main.py", line 162, in main
main_unit(node, show_header)
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\pls\main.py", line 143, in main_unit
printer.print(show_header)
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\pls\output\printers.py", line 32, in print
self.print_output()
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\pls\output\table_printer.py", line 139, in print_output
self.console.print(self.table)
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\console.py", line 1694, in print
extend(render(renderable, render_options))
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\console.py", line 1326, in render
for render_output in iter_render:
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\table.py", line 484, in __rich_console__
widths = self._calculate_column_widths(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\table.py", line 525, in _calculate_column_widths
width_ranges = [
^
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\table.py", line 526, in <listcomp>
self._measure_column(console, options, column) for column in columns
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\table.py", line 729, in _measure_column
_min, _max = get_render_width(console, options, cell.renderable)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\measure.py", line 109, in get
get_console_width(console, options)
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\padding.py", line 132, in __rich_measure__
measure_min, measure_max = Measurement.get(console, options, self.renderable)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\measure.py", line 99, in get
renderable = console.render_str(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\console.py", line 1424, in render_str
rich_text = render_markup(
^^^^^^^^^^^^^^
File "C:\Users\junderwo\AppData\Roaming\Python\Python311\site-packages\rich\markup.py", line 168, in render
raise MarkupError(
rich.errors.MarkupError: closing tag '[/]' at position 61 has nothing to close
I expect to see a formatted list of the directory...
Permissions Size Modified at Name
d rwx rwx rwx - 2023-05-04 07:51:49 ๏ป Current/
d rwx rwx rwx - 2023-05-04 07:51:56 ๏ป v2.0.9/
I installed pls
using this command: pip install --upgrade --user pls
.
This is what my directory looks like using ls
:
$ ls
Directory: C:\tools\gsudo
Mode LastWriteTime Length Name
---- ------------- ------ ----
l---- 5/4/2023 6:44 AM Current -> C:\tools\gsudo\v2.0.9\
d---- 5/4/2023 6:44 AM v2.0.9
When using pls
in table ode, any fields containg a date are highlighted somewhat strange. The color of the year and seconds are not the same as the other components.
pls -a -d ctime
The whole date field has the same color.
I suspect rich
for the output formatting lapse. But I can't reproduce this with rich
:
import rich
rich.print("2022-03-01 10:00:00")
gives me the date and the time in one color for the time and date respectively.
Maybe add markup=False
on the ourput for date colums?
Steam uses a broken symlink in the home folder for backwards compatibility:
.steampath -> /home/username/.steam/sdk32/steam
pls
crashes while trying to read this
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/usr/lib/python3.10/site-packages/pls/fs/list.py", line 43, in parse_nodes
return Node(node_name, path=node_path)
File "/usr/lib/python3.10/site-packages/pls/models/node.py", line 26, in __init__
self.stat = path.stat()
File "/usr/lib/python3.10/pathlib.py", line 1095, in stat
return self._accessor.stat(self, follow_symlinks=follow_symlinks)
FileNotFoundError: [Errno 2] No such file or directory: '/home/username/.steampath'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/pls", line 33, in <module>
sys.exit(load_entry_point('pls==1.6.0', 'console_scripts', 'pls')())
File "/usr/lib/python3.10/site-packages/pls/main.py", line 16, in main
nodes = read_input()
File "/usr/lib/python3.10/site-packages/pls/fs/list.py", line 55, in read_input
comp_nodes = pool.map(parse_nodes, all_nodes)
File "/usr/lib/python3.10/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/lib/python3.10/multiprocessing/pool.py", line 771, in get
raise self._value
FileNotFoundError: [Errno 2] No such file or directory: '/home/username/.steampath'
All the folders have ? icon (attached screenshot) , is this the default icon? Am I missing something?
pls
Folders should have a icon based on name (for common folders) or have just a folder icon, but seeing question mark.
One of the most requested features lacking in pls
but present in its main competition, exa is a tree view.
A tree view is very useful to see the contents of a directory, and it's subdirectories, and their subdirectories and so on in a single view.
exa has this feature, accessible with the --tree
flag but pls
does not. Adding it would close the gap, making pls
's features a superset of exa.
In documentation as well as output, when pls
refers to ctime
, it characterizes that time as the file's creation time. This is a common misconception. On most unix and unix-like operating systems, ctime
is The inode's "change time." In fact I believe there is no POSIX standard to track file creation time (sometimes called birthtime).
Some filesystems (e.g., APFS & HFS+ on macOS) do report file creation time, where as others (e.g., ext4 on Linux) do not.
How does that differ from mtime
you may ask. mtime
(as well as ctime
) is updated when the contents of the inode are changed. If only the file's metadata (e.g., ownership, permissions, etc.) are changed, then only the inode's ctime
will be updated.
ls -l > listing.txt
stat
itpls -d ctime -d mtime -d atime
the file & see the respective times matchchmod +x
the filestat
and pls
the file as beforectime
has been updated, which is clearly not the file's creation timeIn documentation as well as output ctime
should be referred to as "change time" or simply ctime
maOS:
ProductName: macOS
ProductVersion: 12.3.1
BuildVersion: 21E258
Ubuntu:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
Debug and fix CI, which keeps failing in the repo. This might need an update to Poetry and some dependencies.
I looked at the documentation, I thought I would be able to configure the way pls would be displayed without passing some options on CLI each time.
I thought it would be documented here https://pls.cli.rs/reference/conf/#app_const
I found a lot of examples on how to customize the rendering of something, but not about setting via the configuration file the value that are described on this page
Did I miss something ?
create an alias to launch pls=pls --grid true
Many command line tools have user-level configs in the home directory, but offer ways to de-clutter that directory by setting custom environmental variables. pls
could support this idea fairly simply (I think?).
pls
could read an environmental variable called PLS_USER_CONFIG_DIR
(or something like that) when constructing the conf_paths
list in config/files.py
.
There is already at least one environmental variable used by pls
, so I don't think it would be too odd to support another one.
I admit, I'm not too familiar with the architecture of pls
, but a quick look through config/files.py
and globals/state.py
makes me think implementing this wouldn't be too difficult.
Adding a function get_user_conf()
before get_home_conf()
in find_configs()
could work. Something along the lines of:
def get_user_conf():
user_conf_dir = os.getenv("PLS_USER_CONFIG_DIR")
if user_conf_dir is None:
return None
test_path = user_conf_dir.joinpath(conf_name)
return test_path if _is_valid(test_path) else None
This could be inserted into find_configs()
:
def find_configs():
...
if ancestor_confs := get_ancestor_confs(curr_dir):
conf_paths.extend(ancestor_confs)
if user_conf := get_user_conf():
conf_paths.append(user_conf)
if (home_conf := get_home_conf()) and home_conf not in conf_paths:
conf_paths.append(home_conf)
...
Hi,
Really minor issue regarding the instructions for uninstalling from pipx in getting started.
Instructions show pipx uninstall peotry
instead of pls
.
Really enjoying pls
! Great job!
BTW Found out about pls
via the Python Bytes podcast (episode 272) - also broadcast on YT.
Thanks
Michael
When running pls
in an empty directory there is traceback debug information given. This seems like a crash in the application. I would be expecting to see no output.
mkdir /tmp/empty
cd /tmp/empty
pls
I would expect to see no print results.
When I run pls
, it crashes every time with the error listed in the issue title.
I expected it to work correctly.
Traceback (most recent call last):
File "/Users/ybxh061/.local/bin/pls", line 5, in <module>
from pls.main import main
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/main.py", line 2, in <module>
from pls import globals
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/globals.py", line 124, in <module>
state.parse_args([]) # parse a blank list of arguments as the default
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/globals.py", line 64, in parse_args
self.setup()
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/globals.py", line 73, in setup
getattr(self, f"setup_{setup_fn}")()
File "/Users/ybxh061/.local/pipx/venvs/pls/lib/python3.10/site-packages/pls/globals.py", line 112, in setup_user_groups
self.groups.add(getgrgid(gid).gr_name)
KeyError: 'getgrgid(): gid not found: <NUMBER>'
Cool software! Just one simple thing I've noticed while browsing the README
: the link to "customization" README points to nothing. Probably should be https://github.com/dhruvkb/pls/blob/main/src/pls/data/README.md (notice the src
) instead of https://github.com/dhruvkb/pls/blob/main/pls/data/README.md.
pls *
or pls <dir1> <dir2>
currently shows the help and an error. It would be great if pls
could show the contents of multiple directories in one command like ls
can.
The code points have been updated as the material icons are in version 3.0. Because of this, icons such as nf-mdi-git
, which are currently used as default, are not displayed normally. All default nf-mdi-*
icons should be replaced.
echo "\ufc1d \uf5e1 \uf7a1 \uf7e8 \uf81f \ufc0c \ufcb5 \uf668 \ufb67 \ufa66 \ufd42"
File in git repo with space, shlex.split() make a longer list than accepted by PLS.
Create the file
mkdir test
cd test
git init
touch "file.txt badly formatted with more word than the 3 accepted by the code"
Just run pls
and it raise ExecException: Could not parse Git status code.
The status can be wrong if components == 3
Do not raise exception, perhaps log warning. And have a better split.
The following two commands make pls
trapped:
$ mkdir -p /tmp/dir/qq
$ ln -s /tmp/dir/qq pp
$ pls
Traceback (most recent call last):
File "/home/george/venv/_pls/bin/pls", line 8, in <module>
sys.exit(main())
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/main.py", line 16, in main
node_map, node_list = read_input()
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/fs/list.py", line 82, in read_input
node_list.sort(key=sort_key, reverse=args.sort.endswith("-"))
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/fs/list.py", line 26, in sort_key
key = node.sort_keys[args.sort.rstrip("-")]
File "/usr/lib64/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/models/node.py", line 207, in sort_keys
"type": self.type_char,
File "/usr/lib64/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/models/mixins/type.py", line 50, in type_char
return type_char_map[self.node_type]
File "/usr/lib64/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/models/mixins/type.py", line 41, in node_type
self.populate_dest()
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/models/mixins/type.py", line 69, in populate_dest
self.dest_node = self.__class__(name=link_path, path=link)
File "/home/george/venv/_pls/lib64/python3/site-packages/pls/models/mixins/git.py", line 28, in __init__
self.path_wrt_git = self.path.relative_to(state.git_root)
File "/usr/lib64/python3.10/pathlib.py", line 816, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/tmp/dir/qq' is not in the subpath of '/home/george' OR one path is relative and the other is absolute.
I was looking for how i could use pls to only show files/directories that doesn't starts with dot, i was trying with
-e '.*'
but it also excludes for example test.rs from the showed list.
I think would be cool for this project have some boolean flag to decide if it shows or not the dotfiles.
Exception is throw when trying to list directories that the user has not access to view.
Create the temporary files
mkdir /tmp/test
touch /tmp/test/test
sudo chown -R root:root /tmp/test
sudo chmod -R 400 /tmp/test
Checkout from ls
ls /tmp/test
ls: cannot open directory '/tmp/test': Permission denied`
When trying the same with pls
an exception is throw.
pls /tmp/test
Traceback (most recent call last):
File "/home/boomatang/.local/bin/pls", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/main.py", line 160, in main
node_specific_init(node, cli_prefs)
File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/main.py", line 64, in node_specific_init
state.state.setup_git(node)
File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/globals/state.py", line 120, in setup_git
self.git_root = get_git_root(directory)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/fs/git.py", line 73, in get_git_root
proc = exec_git(
^^^^^^^^^
File "/home/boomatang/.local/pipx/venvs/pls/lib64/python3.11/site-packages/pls/fs/git.py", line 52, in exec_git
proc = subprocess.run(
^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.11/subprocess.py", line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: PosixPath('/tmp/test')
Would have expected a better error message.
Solo files should be collected into a single table/grid when listing. If separated into their own groups, they waste a lot of space.
$ pls /bin/ls /usr/bin/sqlite3 /Users/dhruvkb/Developer/personal/mega/pls -g=true
Here's how ls
and exa
both handle the same input arguments.
The individual files are collected and displayed as one grid, and the directory appears in its own grid with a heading.
In certain specific cases, such as when listing files in the same directory, name-filters can be used to emulate the expected behaviour.
This issue was raised in discussion #81.
The new rust version of pls does not support Windows.
I love pls! The old python version of pls supported Windows (mostly) and is my default ls program. However, the new rust version does not. It is also really useful for those of us who use both Windows and Linux (WSL) to have the same ls tool on both platforms. Please consider supporting Windows with the new rust implementation. Thank you!
https://github.com/pls-rs/pls/blob/main/docs%2Fsrc%2Fcontent%2Fdocs%2Fabout%2Fcomparison.mdx this file is somehow outdated
exa is no longer maintained, eza was created.
Installed pls via the pip --user install.
Specifically:
pip install --user --upgrade pls
When I run it complains about You may need to add PYTHONIOENCODING=utf-8 to your environment and even if I do that, it doesn't work.
using zsh
pls to run without error
the actual commands/errors:
$ export PYTHONIOENCODING=utf-8
$ pls
Traceback (most recent call last):
File "/home/ermesa/.local/bin/pls", line 8, in
sys.exit(main())
File "/home/ermesa/.local/lib/python3.9/site-packages/pls/main.py", line 31, in main
write_output(node_list)
File "/home/ermesa/.local/lib/python3.9/site-packages/pls/table/table.py", line 116, in write_output
console.print(table)
File "/home/ermesa/.local/lib/python3.9/site-packages/rich/console.py", line 1637, in print
self._buffer.extend(new_segments)
File "/home/ermesa/.local/lib/python3.9/site-packages/rich/console.py", line 837, in exit
self._exit_buffer()
File "/home/ermesa/.local/lib/python3.9/site-packages/rich/console.py", line 795, in _exit_buffer
self._check_buffer()
File "/home/ermesa/.local/lib/python3.9/site-packages/rich/console.py", line 1929, in _check_buffer
self.file.write(text)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udccf' in position 99: surrogates not allowed
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***
Currently when a new version of pls comes out, it seems that every time the user uses the tool it appends to the output that there is an upgrade. It seems like it might even make an HTTP request every time? I would suggest that this feature should at least be toggleable at the config level and documented. I would go further and argue that this should probably be avoided altogether or defaulted to off.
This can be problematic if you're using it for scripts and can be quite annoying to the user, especially if they install through their package manager and just have to wait for the update to become available. It also seems inappropriate that a relatively low level command would insist so heavily in upgrades or make an HTTP call on every use.
When running pls with -d option (detailed view) and when there are no results (empty directory, or no files matching the regex), I get the following error :
thread 'main' panicked at src/output/table.rs:76:29:
range end index 1 out of range for slice of length 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fish: Job 1, 'pls -d std --only="^\."' terminated by signal SIGABRT (Abort)
pls
specifications:
Device specifications:
I couldn't find a nerd font icon for excel spreadsheets (.xlsx or .xls), but I found a nice icon I would have liked to use here.
My understanding is that this would require 2 things to be implemented:
I don't know if this is feasible, but it would be great!
I couldn't find an alternative way to solve the above problem.
I usually use pipx to install command-line utilities that happen to be written in Python but are meant to be installed globally.
pls installs well with pipx and I'd recommend noting this in the installation instructions.
rich-cli, poetry, nox, and pyxtermjs all mention pipx installation instructions in their documentation for example.
Creating for the PR form.
I don't know if it has compatibility with pwsh (PowerShell 7.2.1), but it would be nice.
โฏ pls
Traceback (most recent call last):
File "C:\Users\fernando\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\fernando\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\fernando\AppData\Roaming\Python\Python310\Scripts\pls.exe\__main__.py", line 7, in <module>
File "C:\Users\fernando\AppData\Roaming\Python\Python310\site-packages\pls\main.py", line 16, in main
nodes = read_input()
File "C:\Users\fernando\AppData\Roaming\Python\Python310\site-packages\pls\fs\list.py", line 82, in read_input
all_nodes.sort(key=sort_key, reverse=args.sort == SortOrder.DESC)
File "C:\Users\fernando\AppData\Roaming\Python\Python310\site-packages\pls\fs\list.py", line 31, in sort_key
prefix = "0" if node.node_type == NodeType.DIR else "1"
File "C:\Users\fernando\AppData\Local\Programs\Python\Python310\lib\functools.py", line 981, in __get__
val = self.func(instance)
File "C:\Users\fernando\AppData\Roaming\Python\Python310\site-packages\pls\models\node.py", line 82, in node_type
node_type = get_node_type(self.path)
File "C:\Users\fernando\AppData\Roaming\Python\Python310\site-packages\pls\fs\stats.py", line 130, in get_node_type
raise ExecException("Could not determine type of the node.")
pls.exceptions.ExecException: Could not determine type of the node.
is_dir
can throw an OSError, which is not catched.
Traceback (most recent call last):
File "/home/grzegorzmilka/.local/bin/pls", line 8, in <module>
sys.exit(main())
File "/home/grzegorzmilka/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/main.py", line 102, in main
node_map, node_list = read_input()
File "/home/grzegorzmilka/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/fs/list.py", line 72, in read_input
node_map = {
File "/home/grzegorzmilka/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/fs/list.py", line 75, in <dictcomp>
if (parsed_node := parse_node(parent_path, node))
File "/home/grzegorzmilka/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/fs/list.py", line 38, in parse_node
if node_path.is_dir():
File "/usr/lib/python3.9/pathlib.py", line 1439, in is_dir
return S_ISDIR(self.stat().st_mode)
File "/usr/lib/python3.9/pathlib.py", line 1232, in stat
return self._accessor.stat(self)
OSError: [Errno 126] Required key not available: '/home/grzegorzmilka/target'
I don't know how to reproduce this. target
is a symbolic link to a directory, which is inaccessible at the time of the call.
No error is thrown. Maybe the directory doesn't get any special symbol or is marked with red.
First of all congratulations for the excellent work.
When I run the pls
command in a folder like /etc
or /dev
I'm getting this error.
Traceback (most recent call last):
File "/home/aeagiraldelli/.local/bin/pls", line 8, in <module>
sys.exit(main())
File "/home/aeagiraldelli/.local/lib/python3.8/site-packages/pls/main.py", line 16, in main
nodes = read_input()
File "/home/aeagiraldelli/.local/lib/python3.8/site-packages/pls/fs/list.py", line 82, in read_input
all_nodes.sort(key=sort_key, reverse=args.sort == SortOrder.DESC)
File "/home/aeagiraldelli/.local/lib/python3.8/site-packages/pls/fs/list.py", line 31, in sort_key
prefix = "0" if node.node_type == NodeType.DIR else "1"
File "/usr/lib/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "/home/aeagiraldelli/.local/lib/python3.8/site-packages/pls/models/node.py", line 93, in node_type
self.dest_node = Node(name=link_path, path=link)
TypeError: __init__() missing 1 required positional argument: 'state'
open a terminal
cd /etc
pls --details
I'm using
I installed pls
using pipx
pipx list
venvs are in /home/aeagiraldelli/.local/pipx/venvs
apps are exposed on your $PATH at /home/aeagiraldelli/.local/bin
package glances 3.2.4.2, installed using Python 3.8.10
- glances
package pls 1.8.0, installed using Python 3.8.10
- pls
On my system I have a number of folders that are owned by a user that does not exist on the system (502 in this case, this is ls -Fla
output):
drwxr-xr-x 18 adamparkin staff 576 20 Mar 2021 site2/
drwxr-xr-x 19 adamparkin staff 608 27 Apr 2021 skeleton/
drwxr-xr-x 6 502 staff 192 7 Dec 2014 slack-cli/
drwxr-xr-x 6 502 staff 192 14 Feb 2016 slackcmd/
Can see that two of those directories are owned by me (adamparkin
) and two by a non-existent user (502
). When I run pls -d
in this directory it crashes with:
ฮป pls -d
Traceback (most recent call last):
File "/Users/adamparkin/.local/bin/pls", line 8, in <module>
sys.exit(main())
File "/Users/adamparkin/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/main.py", line 34, in main
write_output(node_list)
File "/Users/adamparkin/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/output/table.py", line 114, in write_output
tabulate_node(table, node)
File "/Users/adamparkin/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/output/table.py", line 91, in tabulate_node
data = node.table_row
File "/opt/homebrew/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/functools.py", line 969, in __get__
val = self.func(instance)
File "/Users/adamparkin/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/models/node.py", line 185, in table_row
cells.update(self.stat_cells)
File "/opt/homebrew/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/functools.py", line 969, in __get__
val = self.func(instance)
File "/Users/adamparkin/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/models/mixins/stat.py", line 63, in stat_cells
cells[column] = function(self.stat, *func_args)
File "/Users/adamparkin/.local/pipx/venvs/pls/lib/python3.9/site-packages/pls/fs/stats.py", line 86, in get_formatted_user
pw_name = getpwuid(stat.st_uid).pw_name
KeyError: 'getpwuid(): uid not found: 502'
See description
It not to throw an exception and produce the same output as ls
N/A
These folders with the missing user got created by copying directories from a backup from another old Macbook to this machine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.