lf File Manager Configuration Comparison B
10. extract-to Command
Key Binding: ah
(current directory), ax
(/tmp/), aX
(custom path)
Code Comparison:
- Lumesh: Uses regex matching and built-in file functions
if (Regex.match '\.([gb7xs]z|t[gbx]z|zip|zst|bz2|lz4|lzma|tar|rar|br)$' $f) { |
- Bash: Uses case statement and string processing
case "$f" in |
Advantages:
- Lumesh: Regex is more flexible, built-in path operation functions are type-safe
- Bash: Case statement has better performance, pattern matching is concise and intuitive
11. compress-to Command
Key Binding: ac
(/tmp/compress)
Code Comparison:
- Lumesh: Uses string methods and conditional expressions
if $dest.ends_with('/'){ |
- Bash: Uses test command and string operations
if test "$(echo $1 | grep '/$')" -o -d "$1" ; then |
Advantages:
- Lumesh: String methods are more intuitive, conditional expressions are concise
- Bash: Test command is standardized, dirname/basename tools are mature
12. diff Series Commands
Key Binding: df
(diff), dt
(delta), dm
(md5 comparison)
Code Comparison:
- Lumesh: Uses array indexing and ternary operator
let files = $fs.lines() |
- Bash: Uses positional parameters and conditional checks
set -- $fs |
Advantages:
- Lumesh: Array operations are intuitive, method chaining is concise, ternary operator is elegant, conditional statements are more straightforward
- Bash: Positional parameters are flexible, cut command is efficient, conditional checks are clear
13. check-sum Command
Key Binding: dc
Code Comparison:
- Lumesh: Uses pattern matching
let ext_name = Fs.base_name(True, $fx).last() |
- Bash: Uses case statement
case "$fx" in |
Advantages:
- Lumesh: Powerful pattern matching, type-safe file extension extraction. Also supports regex and wildcard patterns.
- Bash: Case statement has excellent performance, wildcard matching is simple and direct
14. cmus-play Command
Key Binding: Om
Code Comparison:
- Lumesh: Uses conditional expressions and error handling
pgrep -x cmus ?: foot cmus |
- Bash: Uses conditional checks and logical operators
if [ -z "$(pgrep -x cmus)" ]; then |
Advantages:
- Lumesh: Error handling operator
?:
is concise, code is more compact - Bash: Conditional logic is clear, logical operator
&&
allows for standard chaining
15. umount-dev Command
Key Binding: mu
Code Comparison:
- Lumesh: Uses structured data and optional chaining
let sel = lsblk -rno 'name,type,size,mountpoint,label,fstype' | Into.table([name,'type',size,mountpoint,label,fstype]) \ |
- Bash: Uses awk and string processing
x=$(mount | awk '$1 ~ /^\/dev/ && $3 !~/^\/(home|boot|var)?$/ {sub(/^\/dev\//, "", $1); print $1,$5,$3}' | fzf --prompt='choose to UMount: ' --preview='' | awk '{print $3}') |
Advantages:
- Lumesh: Powerful structured data processing,
?.
elegantly ignores unselected errors, field access is type-safe - Bash: Awk regex processing is flexible, pipeline combinations are efficient, string matching is mature
16. on-cd Command
Key Binding: None (automatically triggered)
Code Comparison:
- Lumesh: Uses system functions
Sys.print_tty `\033]0;lf $PWD\007` |
- Bash: Uses printf redirection
printf "\033]0;lf $PWD\007" > /dev/tty |
Advantages:
- Lumesh: System function encapsulation is safer, API is clearer
- Bash: Directly operating device files allows for more precise control
17. drag Series Commands
Key Binding: di
(drag in), do
(drag out)
Code Comparison:
- Lumesh: Uses built-in file functions
dest=dragon-drop --target -x -p |
- Bash: Uses basename command
dest=$(dragon-drop --target -x -p) |
Advantages:
- Lumesh: Built-in file functions are type-safe, variable scope is clear
- Bash: Basename command is standardized, command substitution is direct
Complete Comparison Summary
Syntax Feature Comparison
Feature | Lumesh | Bash |
---|---|---|
Conditional Expression | condition ? true_val : false_val |
`[ condition ] && true_cmd |
Pattern Matching | match expr { pattern => action } |
case expr in pattern) action ;; |
Array Operations | .lines() , .map() , .filter() |
awk , cut , sed |
Error Handling | cmd ?: default |
`cmd |
String Methods | .split() , .join() , .ends_with() |
cut , grep , test |
File Operations | Fs.base_name() , Fs.join() |
basename , dirname |
Continue reading: