Fix support for filenames starting with - (hiphen)

Make it possible to create, delete, copy, move, rename filenames starting
with a - (hiphen).
pull/115/head v0.5.9
Arijit Basu 3 years ago committed by Arijit Basu
parent 2437fd67cf
commit 4dad10815a

2
Cargo.lock generated

@ -1630,7 +1630,7 @@ dependencies = [
[[package]]
name = "xplr"
version = "0.5.8"
version = "0.5.9"
dependencies = [
"anyhow",
"chrono",

@ -1,6 +1,6 @@
[package]
name = "xplr"
version = "0.5.8" # Update config.yml, config.rs and default.nix
version = "0.5.9" # Update config.yml, config.rs and default.nix
authors = ["Arijit Basu <sayanarijit@gmail.com>"]
edition = "2018"
description = "A hackable, minimal, fast TUI file explorer"

@ -1020,6 +1020,7 @@ impl Config {
pub fn is_compatible(&self) -> Result<bool> {
let result = match self.parsed_version()? {
(0, 5, 9) => true,
(0, 5, 8) => true,
(0, 5, 7) => true,
(0, 5, 6) => true,
@ -1037,7 +1038,8 @@ impl Config {
pub fn upgrade_notification(&self) -> Result<Option<&str>> {
let result = match self.parsed_version()? {
(0, 5, 8) => None,
(0, 5, 9) => None,
(0, 5, 8) => Some("App version updated. Fixed support for filenames starting with - (hiphen)"),
(0, 5, 7) => Some("App version updated. Fixed distorted screen when opening files in GUI"),
(0, 5, 6) => Some("App version updated. Fixed piping and in-built terminal support"),
(0, 5, 5) => Some("App version updated. Significant reduction in CPU usage"),

@ -1,4 +1,4 @@
version: v0.5.8
version: v0.5.9
general:
show_hidden: false
read_only: false
@ -302,7 +302,7 @@ modes:
messages:
- BashExec: |
(while IFS= read -r line; do
if cp -vr "${line:?}" ./; then
if cp -vr -- "${line:?}" ./; then
echo "LogSuccess: $line copied to $PWD" >> "${XPLR_PIPE_MSG_IN:?}"
else
echo "LogError: Failed to copy $line to $PWD" >> "${XPLR_PIPE_MSG_IN:?}"
@ -318,7 +318,7 @@ modes:
messages:
- BashExec: |
(while IFS= read -r line; do
if mv -v "${line:?}" ./; then
if mv -v -- "${line:?}" ./; then
echo "LogSuccess: $line moved to $PWD" >> "${XPLR_PIPE_MSG_IN:?}"
else
echo "LogError: Failed to move $line to $PWD" >> "${XPLR_PIPE_MSG_IN:?}"
@ -349,7 +349,7 @@ modes:
messages:
- BashExecSilently: |
PTH="${XPLR_INPUT_BUFFER:?}"
if touch "${PTH:?}"; then
if touch -- "${PTH:?}"; then
echo Explore >> "${XPLR_PIPE_MSG_IN:?}"
echo "LogSuccess: $PTH created" >> "${XPLR_PIPE_MSG_IN:?}"
echo "FocusPath: $PTH" >> "${XPLR_PIPE_MSG_IN:?}"
@ -394,7 +394,7 @@ modes:
messages:
- BashExecSilently: |
PTH="${XPLR_INPUT_BUFFER:?}"
if mkdir -p "${PTH:?}"; then
if mkdir -p -- "${PTH:?}"; then
echo Explore >> "${XPLR_PIPE_MSG_IN:?}"
echo "LogSuccess: $PTH created" >> "${XPLR_PIPE_MSG_IN:?}"
echo "FocusPath: $PTH" >> "${XPLR_PIPE_MSG_IN:?}"
@ -478,7 +478,7 @@ modes:
- BashExecSilently: |
SRC="${XPLR_FOCUS_PATH:?}"
TARGET="${XPLR_INPUT_BUFFER:?}"
if mv -v "${SRC:?}" "${TARGET:?}"; then
if mv -v -- "${SRC:?}" "${TARGET:?}"; then
echo Explore >> "${XPLR_PIPE_MSG_IN:?}"
echo "LogSuccess: $SRC renamed to $TARGET" >> "${XPLR_PIPE_MSG_IN:?}"
echo "FocusPath: $TARGET" >> "${XPLR_PIPE_MSG_IN:?}"
@ -1012,13 +1012,13 @@ modes:
- BashExec: |
(while IFS= read -r line; do
if [ -d "$line" ]; then
if rmdir -v "${line:?}"; then
if rmdir -v -- "${line:?}"; then
echo "LogSuccess: $line deleted" >> "${XPLR_PIPE_MSG_IN:?}"
else
echo "LogError: Failed to delete $line" >> "${XPLR_PIPE_MSG_IN:?}"
fi
else
if rm -v "${line:?}"; then
if rm -v -- "${line:?}"; then
echo "FocusNext" >> "${XPLR_PIPE_MSG_IN:?}"
echo "LogSuccess: $line deleted" >> "${XPLR_PIPE_MSG_IN:?}"
else
@ -1035,7 +1035,7 @@ modes:
messages:
- BashExec: |
(while IFS= read -r line; do
if rm -rfv "${line:?}"; then
if rm -rfv -- "${line:?}"; then
echo "FocusNext" >> "${XPLR_PIPE_MSG_IN:?}"
echo "LogSuccess: $line deleted" >> "${XPLR_PIPE_MSG_IN:?}"
else
@ -1089,7 +1089,7 @@ modes:
help: open in editor
messages:
- BashExec: |
${EDITOR:-vi} "${XPLR_FOCUS_PATH:?}"
${EDITOR:-vi} -- "${XPLR_FOCUS_PATH:?}"
- SwitchMode: default
s:
@ -1101,7 +1101,7 @@ modes:
help: logs
messages:
- BashExec: |
cat "${XPLR_PIPE_LOGS_OUT}"
cat -- "${XPLR_PIPE_LOGS_OUT}"
read -p "[enter to continue]"
- SwitchMode: default

Loading…
Cancel
Save