nushell/crates/nu-command
Sebastian Nallar cb57f0a539
Add --follow-symlinks flag to glob command (fixes #15559) (#15626)
Fixes #15559

# Description
The glob command wasn't working correctly with symlinks in the /sys
filesystem. This commit adds a new flag that allows users to explicitly
control whether symlinks should be followed, with special handling for
the /sys directory.

The issue was that the glob command didn't follow symbolic links when
traversing the /sys filesystem, resulting in an empty list even though
paths should be found. This implementation adds a new
`--follow-symlinks` flag that explicitly enables following symlinks. By
default, it now follows symlinks in most paths but has special handling
for /sys paths where the flag is required.

Example:
`
# Before: This would return an empty list on Linux systems
glob /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

# Now: This works as expected with the new flag
glob /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
--follow-symlinks
`

# User-Facing Changes

1. Added the --follow-symlinks (-l) flag to the glob command that allows
users to explicitly control whether symbolic links should be followed
2. Added a new example to the glob command help text demonstrating the
use of this flag

# Tests + Formatting

1. Added a test for the new --follow-symlinks flag
2025-04-23 10:47:48 -05:00
..
src Add --follow-symlinks flag to glob command (fixes #15559) (#15626) 2025-04-23 10:47:48 -05:00
tests Add --follow-symlinks flag to glob command (fixes #15559) (#15626) 2025-04-23 10:47:48 -05:00
Cargo.toml build(deps): bump data-encoding from 2.8.0 to 2.9.0 (#15580) 2025-04-16 22:14:36 +08:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00
README.md Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00

This crate contains the majority of our commands

We allow ourselves to move some of the commands in nu-command to nu-cmd-* crates as needed.

Internal Nushell crate

This crate implements components of Nushell and is not designed to support plugin authors or other users directly.