Commit Graph

85 Commits

Author SHA1 Message Date
Andreas Kling
137237b9c2 ls: Use Core::File::real_path_for() 2021-01-03 19:16:39 +01:00
Ben Wiederhake
4ec77ba929 Userland: Write some '--help' descriptions where appropriate 2020-12-06 00:06:53 +01:00
Andreas Kling
b413c7ae6a ls: Only append file type indicators when -F or --classify is specified 2020-11-11 20:46:06 +01:00
Andreas Kling
5aafbdc4e8 ls: Add newline after "ls -d" output
Fixes #4030.
2020-11-11 20:36:16 +01:00
Brendan Coles
28abfd6290 Userland: ls: Add -d / --directory flag 2020-11-10 18:56:27 +01:00
Brendan Coles
7e0204fb41 Userland: ls: Add -o and -B / --ignore-backups flags
* `-B`, --ignore-backups`: Do not list implied entries ending with ~
* `-o`, In long format, do not show group information
2020-11-10 14:22:49 +01:00
Brendan Coles
51f49ec73f ls: Add -A flag to show dot files excluding implied . and .. directories 2020-11-10 12:04:12 +01:00
Brendan Coles
e7173e946f ls: print inodes in short output format when -i arg is supplied 2020-11-09 07:56:56 +01:00
Brendan Coles
88307fcb59 ls: Add colored output for set-gid files 2020-11-02 13:09:17 +01:00
Tom
6413acd78c AK: Make Utf8View and Utf32View more consistent
This enables use of these classes in templated code.
2020-10-22 15:23:45 +02:00
Andreas Kling
3c73b6d531 ls: Fix issue with too-narrow columns in "ls" output
There was a logic mistake in the code that computes the offset between
columns, forgetting to account for the extra characters after a name.

The comment was accurate, but the code didn't match the comment.
2020-08-28 12:58:05 +02:00
Nico Weber
aa97166739 Everywhere: Consolidate human_readable_size() implementations
Let's use the one in AK/NumberFormat.h everywhere.

It has slightly different behavior than some of the copies this
removes, but it's probably nice to have uniform human readable
size outputs across the system.
2020-08-16 16:33:28 +02:00
Nico Weber
430b265cd4 AK: Rename KB, MB, GB to KiB, MiB, GiB
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9".
The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30".

Let's use the correct name, at least in code.

Only changes the name of the constants, no other behavior change.
2020-08-16 16:33:28 +02:00
Ben Wiederhake
0248ddc427 Userland: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Sergey Bugaev
eb7af00152 Userland: Use Core::File::read_link() 2020-06-17 15:02:03 +02:00
AnotherTest
07c070745f ls: Emit plain text when output is not a tty 2020-06-08 09:27:51 +02:00
Andreas Kling
dd924b730a Kernel+LibC: Fix various build issues introduced by ssize_t
Now that ssize_t is derived from size_t, we have to
2020-05-23 15:27:33 +02:00
Andreas Kling
cc42d75209 ls: Make column alignment Unicode-aware :^)
You can now have emojis in file names and they will line up correctly
in "ls" output.
2020-05-17 13:05:39 +02:00
Andreas Kling
3667677008 ls: Emit hyperlinks for files outside the current directory 2020-05-10 17:48:41 +02:00
Andreas Kling
00b87167fe ls: Make filenames in the output hyperlinked
This allows you to Ctrl+Click in Terminal to open files in "ls" output.
2020-05-09 16:17:47 +02:00
Hüseyin ASLITÜRK
e00b85b8c0 Userland/ls: Remove unnecessary output 2020-04-25 12:09:46 +02:00
Sergey Bugaev
f18d6610d3 Kernel: Don't include null terminator in sys$readlink() result
POSIX says, "Conforming applications should not assume that the returned
contents of the symbolic link are null-terminated."

If we do include the null terminator into the returning string, Python
believes it to actually be a part of the returned name, and gets unhappy
about that later. This suggests other systems Python runs in don't include
it, so let's do that too.

Also, make our userspace support non-null-terminated realpath().
2020-04-14 18:40:24 +02:00
Andreas Kling
686ade6b5a AK: Make quick_sort() a little more ergonomic
Now it actually defaults to "a < b" comparison, instead of forcing you
to provide a trivial less-than comparator. Also you can pass in any
collection type that has .begin() and .end() and we'll sort it for you.
2020-03-03 16:02:58 +01:00
Andreas Kling
ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Andreas Kling
e22283e5e6 Userland: Use Core::DateTime 2020-02-11 20:43:29 +01:00
Andreas Kling
d17e23bd27 LibCore: Remove leading C from filenames 2020-02-06 15:04:03 +01:00
Andreas Kling
2d39da5405 LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
2020-02-02 15:15:30 +01:00
Sergey Bugaev
f983dfe319 Userland+Terminal: Port to new CArgsParser API
While at it, also add some niceties and fix some things.
2020-01-28 13:50:18 +01:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Sergey Bugaev
cf04de188e Userland: Print which path we failed to ls 2020-01-17 21:49:58 +01:00
joshua stein
d7e8431cdb Userland/ls: escape non-printable characters
Fixes #1044
2020-01-15 23:13:15 +01:00
Brian Gianforcaro
a77da7f245 ls: Use pledge() 2020-01-13 11:04:35 +01:00
Andreas Kling
73788d7305 ls: Cache the user and group names instead of looking up every time 2020-01-11 13:30:17 +01:00
Andreas Kling
41d5f5c3b5 ls: Widen the user and group fields a little bit
I didn't like looking at /tmp/portal now that lookup:lookup owns one
of the sockets there :^)
2020-01-09 21:43:21 +01:00
Andreas Kling
c9507e8cbe ls: Display SUID files with red background color 2020-01-05 12:49:25 +01:00
Andreas Kling
755938c650 ls: Show directories with the sticky bit in a special color
This makes /tmp show up with a green background in "ls" output.
2020-01-04 11:38:02 +01:00
Andreas Kling
6f4c380d95 AK: Use size_t for the length of strings
Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
2019-12-09 17:51:21 +01:00
Andreas Kling
7b0f3b19df ls: Fix alignment of device files in long mode (ls -l) 2019-10-19 20:54:47 +02:00
Andreas Kling
8a3fabffb3 ls: Add -t and -r flags
-t: Sort by modification time (default is to sort by name)
-r: Reverse sort order

Note that these only apply when used together with -l (long mode.)
2019-10-19 20:54:47 +02:00
Andreas Kling
825fa3463c ls: Add -h (human readable) output switch
Fixes #543.
2019-09-11 18:59:13 +02:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
Andreas Kling
9731bff44c ls: Sort the output alphabetically
Also use StringBuilder to construct the full relative paths, to get rid
of an unnecessary and suspicious-looking buffer.
2019-08-20 21:39:01 +02:00
Andreas Kling
029786e6b5 ls: Don't layout or colorize output if stdout is not a TTY 2019-08-20 21:06:44 +02:00
marprok
d4b7b92492 Userland: ls division by zero.
When the terminal app window became smaller than the longest filename,
a division by zero occured while calculating the offset.
2019-08-20 20:17:10 +02:00
Marios Prokopakis
91c79440a1 Userland: Improved the printing of the ls command. (#468)
The ls command takes into consideration the length of the largest
filename when it prints a line.

Fixes #432.
2019-08-19 16:37:21 +02:00
Andreas Kling
3965fcc484 ls: Don't print an empty line if there were no files to show.
Fixes #352.
2019-07-21 09:26:47 +02:00
Andreas Kling
3b01d7fdff Userland: Fix more compiler warnings. 2019-06-22 16:13:47 +02:00