Skip to content

Commit

Permalink
Merge pull request #81 from qkzk/v0.1.22-dev
Browse files Browse the repository at this point in the history
V0.1.22 dev
qkzk authored Oct 12, 2023
2 parents c8f062f + 8844619 commit 266ccc4
Showing 40 changed files with 2,375 additions and 1,147 deletions.
272 changes: 170 additions & 102 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fm-tui"
version = "0.1.21"
version = "0.1.22"
authors = ["Quentin Konieczko <qu3nt1n@gmail.com>"]
edition = "2021"
license-file = "LICENSE.txt"
@@ -30,7 +30,7 @@ fs_extra = "1.2.0"

[dependencies]
anyhow = "1.0.28"
chrono = "0.4.22"
chrono = "0.4.31"
clap = { version = "4.0.2", features = ["derive"] }
content_inspector = "0.2.4"
copypasta = "0.8.1"
@@ -39,8 +39,9 @@ fs_extra = "1.2.0"
futures = "0.3"
gag = "1.0.0"
indicatif = { version = "0.17.1", features= ["in_memory"] }
lazy_static = "1.4.0"
log = { version = "0.4.0", features = ["std"] }
log4rs = {version = "1.2.0", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] }
log4rs = { version = "1.2.0", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] }
nvim-rs = { version = "0.3", features = ["use_tokio"] }
pathdiff = "0.2.1"
pdf-extract = "0.6.4"
4 changes: 2 additions & 2 deletions config_files/fm/config.yaml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ colors:
socket: cyan
symlink: magenta
keys:
'esc': ModeNormal
'esc': ResetMode
'up': MoveUp
'down': MoveDown
'left': MoveLeft
@@ -65,7 +65,7 @@ keys:
'ctrl-f': FuzzyFind
'ctrl-g': Shortcut
'ctrl-p': CopyFilepath
'ctrl-q': ModeNormal
'ctrl-q': ResetMode
'ctrl-r': RefreshView
'alt-d': DragNDrop
'alt-e': ToggleDisplayFull
5 changes: 1 addition & 4 deletions config_files/fm/logging_config.yaml
Original file line number Diff line number Diff line change
@@ -9,10 +9,7 @@ appenders:
kind: size
limit: 50kb
roller:
kind: fixed_window
base: 1
count: 10
pattern: "$ENV{HOME}/.config/fm/log/fm{}.log"
kind: delete
action_logger:
kind: rolling_file
path: "$ENV{HOME}/.config/fm/log/action_logger.log"
106 changes: 86 additions & 20 deletions development.md
Original file line number Diff line number Diff line change
@@ -453,8 +453,6 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [x] mocp go to song: `mocp -Q %file` with alt+enter (lack of a better keybinding)
- [x] display openers in help
## Current dev
### Version 0.1.21
- [x] more shortcuts like `nnn` : `\` root, @: start
@@ -487,25 +485,97 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [x] event: linked to an Action, same name
- [x] exec: linked to an executable mode, same name
- [x] every helper should be moved outside the struct
- [x] FIX: impossible to compile on MacOs since to `sysinfo::Disk` only implement `PartialEq` on linux.
Can't test MacOs compilation since I don't own a mac...
- [x] FIX: impossible to compile on MacOs since to `sysinfo::Disk` only implement `PartialEq` on linux.
Can't test MacOs compilation since I don't own a mac...
- [x] FIX: incompatible config files between versions crashes the app.
- [x] FIX: Help string susbtitution aren't aligned properly
- [x] FIX: exiting preview doesn't refresh
- [x] Mode should know if a refresh is required after leaving them.
## Current dev
### Version 0.1.22
- [x] FIX: copying 0 bytes crash progress bar thread
- [x] FIX: refresh users (from tab) reset the selection in pathcontent.
- [x] FIX: when switching from single to dual pane, sort and position are lost
- [x] FIX: tree mode: move down from bottom crashes
- [x] FIX: inxi --full or inxi -F hangs. Use inxi -v 2 instead
- [x] allow shell expansion (~ -> /home/user) in goto mode
- [x] FIX: mode CHMOD reset the file index
- [x] better display of selected tab. Reverse the colors in the first line
- [x] display a message when trash is empty in trash explore mode (alt-o)
- [x] display last executed action (use a string as message)
- [x] FIX: vertical resize to a smaller window : files expand to the last line and message are overwritten
- [x] FIX: open a secondary window and messages are overwritten by files. Don't display messages...
- [x] FIX: clippy term_manager::windmain has too many arguments. Create a struct holding params for winmain
- [x] NeedConfirmation modes are responsible for their confirmation message
- [x] Use Alt+r to remote mount with sshfs.
- request `username hostname remotepath` in one stroke,
- execute `sshfs remote_user@hostname:remote_path current_path` which will mount the remote path in current path
- [x] FIX: search keybindings don't work. Need to trim a string.
- [x] FIX: archive depends on CWD and will crash if it's not set properly (ie. change tab, move, change tab, compress)
- [x] use memory and not disk to read last line of logs.
- [x] mocp clear playlist with ctrl+x
- [x] FIX: MOCP print error message on screen
- [x] cryptdevice requires lsblk & cryptdevice. Display a message if not installed
- [x] mocp must be installed to run relatives commands
- [x] nitrogen must be installed to set a wallpaper
- [x] mediainfo must be installed to preview a media file with it
- [x] ueberzug must be installed to preview images & font files with it
- [x] pandoc must be installed to preview doc (.doc, .odb)
- [x] jupyter must be installed to preview .ipynb notebooks.
- [x] isoinfo must be installed to preview .iso files
- [x] diff must be installed to preview a diff of 2 files
- [x] git muse be installed to display a git status string
- [x] inform user if file already exits when creating / renaming
- [x] factorise new file & new dir
- [x] metadata in tree mode. Toggle like display full with alt-e
- [x] FIX: pagedown may select a file outside window without scrolling to it
- [x] FIX: multiple scrolling bugs. It should be smooth in every context
- [x] FIX: after scrolling left click doesn't select the correct file
- [x] FIX: page down when few files in current path screw the display
- [x] remove doublons from shortcut (Ctrl+g) "goto mode"
- [x] FIX: scrolling isn't smooth anymore
- [x] InputSimple is responsible of its help lines
- [x] Preview epub. Requires pandoc.
- [x] FIX: symlink aren't displayed at all.
- Improve broken symlink detection and display
- Use `symlink_metadata` to avoid following symlink in tree mode, which may cause recursive filetree
- Don't display symlink destination in tree mode since it clutters the display
- Use a different configurable color for broken symlink
- [x] display selected file in first line
- [x] FIX: sort by size use wrong value and order badly 2B > 1M
- [x] refactor copy move. CopyOrMove is responsible for its setup.
- [x] refactor main. Split setup, exit and main loop.
- [x] refactor main. Use a struct responsible for setup, update, display and quit.
- [x] preview fonts, svg & video thumbnail
- video thumbnail requires ffmpeg
- fonts preview otf not supported
- fonts preview requires fontimage
- svg preview requires rsvg-convert
- [x] preview for special files :
- [x] block device using lsblk
- [x] socket using ss
- [x] fifo & chardevice `lsof path`
- [x] size for char & block device [exa](https://github.com/ogham/exa/blob/fb05c421ae98e076989eb6e8b1bcf42c07c1d0fe/src/fs/file.rs#L331)
- [x] use a struct for ColumnSize
- [x] FIX: goto mode from tree node with a selected file crashes the application
- [x] Not accessible file in tree mode crashes the application
- [x] Look for nvim listen address in `ss -l` output
## TODO
- [ ] while second window is opened, if the selection is below half screen, it's not shown anymore.
Scroll to second element if needed
- [ ] remote control
- [x] filepicker
requires the nvim-remote rust crate installed
- [ ] listen to stdin (rcv etc.)
- [ ] follow change directory
- [ ] when called from a file buffer in nvim, open with this file selected
- [ ] nvim plugin - set a serverstart with a listenaddress, send it to fm
- https://github.com/KillTheMule/nvim-rs/blob/master/examples/basic.rs
- https://neovim.io/doc/user/api.html
- [ ] $NVIM_LISTEN_ADDRESS isn't always set on nbim startup ; can be set from nvim before running... then sent to fm with some args
- [ ] args read correctly, use NVIM_LISTEN_ADDRESS if args is sent
- [ ] display / event separation. use async and message passing between coroutines
@@ -516,12 +586,12 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [ ] read events from stdin ? can't be done from tuikit. Would require another thread ?
- [ ] pushbullet ?
- [ ] update the animation
- [ ] exec multiple flagged files
- [ ] shell menu
- [ ] update the animation
- [ ] exec multiple flagged files
- [ ] shell menu
- [ ] allow non tui like wttr, diff, bat, tail -n etc.
- [ ] more options like "use flagged files" for diff
- [ ] allow non tui like wttr, diff, bat, tail -n etc.
- [ ] more options like "use flagged files" for diff
- [ ] build option to force reset of config file, warn the user at first start
- [ ] optionable "plugin" started from config file. Would require every option to be `Option<Plugin>` and may cause problems with the borrow checker.
@@ -534,12 +604,6 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [ ] list non mounted devices, list all mount points
- [ ] act on them
- [ ] sub window / menu for completion / selection.
1. enter selectable mode
2. chose an action
3. confirm
- [ ] Version 0.1.50 : safety & memory usage
- [ ] there's a memory leak somewhere
@@ -566,7 +630,9 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
## BUGS
- [ ] when opening a file with rifle opener into nvim and closing, the terminal hangs
- [ ] creates $ENV{HOME} folders everywhere -
a new version of log4rs seems to solve this, it's not deplayed to crates.io yet
- [ ] tree mode : index are offset by one
## Won't do
6 changes: 5 additions & 1 deletion src/action_map.rs
Original file line number Diff line number Diff line change
@@ -50,6 +50,7 @@ pub enum ActionMap {
MarksNew,
MediaInfo,
MocpAddToPlayList,
MocpClearPlaylist,
MocpGoToSong,
MocpNext,
MocpPrevious,
@@ -71,6 +72,7 @@ pub enum ActionMap {
Quit,
RefreshView,
RegexMatch,
RemoteMount,
Rename,
ResetMode,
ReverseFlags,
@@ -145,6 +147,7 @@ impl ActionMap {
ActionMap::MarksNew => EventAction::marks_new(current_tab),
ActionMap::MediaInfo => EventAction::mediainfo(current_tab),
ActionMap::MocpAddToPlayList => EventAction::mocp_add_to_playlist(current_tab),
ActionMap::MocpClearPlaylist => EventAction::mocp_clear_playlist(),
ActionMap::MocpGoToSong => EventAction::mocp_go_to_song(current_tab),
ActionMap::MocpNext => EventAction::mocp_next(),
ActionMap::MocpPrevious => EventAction::mocp_previous(),
@@ -165,6 +168,7 @@ impl ActionMap {
ActionMap::Quit => EventAction::quit(current_tab),
ActionMap::RefreshView => EventAction::refreshview(status, colors),
ActionMap::RegexMatch => EventAction::regex_match(current_tab),
ActionMap::RemoteMount => EventAction::remote_mount(current_tab),
ActionMap::Rename => EventAction::rename(current_tab),
ActionMap::ResetMode => EventAction::reset_mode(current_tab),
ActionMap::ReverseFlags => EventAction::reverse_flags(status),
@@ -191,7 +195,7 @@ impl ActionMap {
ActionMap::TreeFold => EventAction::tree_fold(current_tab, colors),
ActionMap::TreeFoldAll => EventAction::tree_fold_all(current_tab, colors),
ActionMap::TreeUnFoldAll => EventAction::tree_unfold_all(current_tab, colors),
ActionMap::Custom(string) => EventAction::custom(status, string.clone()),
ActionMap::Custom(string) => EventAction::custom(status, string),

ActionMap::Nothing => Ok(()),
}
28 changes: 20 additions & 8 deletions src/bulkrename.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ use std::time::{Duration, SystemTime};

use crate::constant_strings_paths::TMP_FOLDER_PATH;
use crate::impl_selectable_content;
use crate::log::write_log_line;
use crate::opener::Opener;
use crate::status::Status;

@@ -115,8 +116,12 @@ impl<'a> Bulkrename<'a> {
let mut file = std::fs::File::create(&self.temp_file)?;

for path in self.original_filepath.clone().unwrap().iter() {
let Some(os_filename) = path.file_name() else { return Ok(()) };
let Some(filename) = os_filename.to_str() else {return Ok(()) };
let Some(os_filename) = path.file_name() else {
return Ok(());
};
let Some(filename) = os_filename.to_str() else {
return Ok(());
};
let b = filename.as_bytes();
file.write_all(b)?;
file.write_all(&[b'\n'])?;
@@ -169,9 +174,11 @@ impl<'a> Bulkrename<'a> {
let new_name = sanitize_filename::sanitize(filename);
self.rename_file(path, &new_name)?;
counter += 1;
info!(target: "special", "Bulk renamed {path} to {new_name}", path=path.display())
let log_line = format!("Bulk renamed {path} to {new_name}", path = path.display());
write_log_line(log_line);
}
info!(target: "special", "Bulk renamed {counter} files");
let log_line = format!("Bulk renamed {counter} files");
write_log_line(log_line);
Ok(())
}

@@ -181,24 +188,29 @@ impl<'a> Bulkrename<'a> {
let mut new_path = std::path::PathBuf::from(self.parent_dir.unwrap());
if !filename.ends_with('/') {
new_path.push(filename);
let Some(parent) = new_path.parent() else { return Ok(()); };
let Some(parent) = new_path.parent() else {
return Ok(());
};
info!("Bulk new files. Creating parent: {}", parent.display());
if std::fs::create_dir_all(parent).is_err() {
continue;
};
info!("creating: {new_path:?}");
std::fs::File::create(&new_path)?;
info!(target:"special", "Bulk created {new_path}", new_path=new_path.display());
let log_line = format!("Bulk created {new_path}", new_path = new_path.display());
write_log_line(log_line);
counter += 1;
} else {
new_path.push(filename);
info!("Bulk creating dir: {}", new_path.display());
std::fs::create_dir_all(&new_path)?;
info!(target:"special", "Bulk created {new_path}", new_path=new_path.display());
let log_line = format!("Bulk created {new_path}", new_path = new_path.display());
write_log_line(log_line);
counter += 1;
}
}
info!(target: "special", "Bulk created {counter} files");
let log_line = format!("Bulk created {counter} files");
write_log_line(log_line);
Ok(())
}

Loading

0 comments on commit 266ccc4

Please sign in to comment.