-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement rclone helpers #1016
Merged
Merged
Implement rclone helpers #1016
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
675fe23
Implement rclone-fzf
kachick 5a69006
Implement rclone-list-mounted
kachick 535b7cd
Update usage about rclone
kachick cdd703e
Uninstall gnome-online-accounts
kachick 7c26b27
Install rclone helpers
kachick 1705f4f
Add columns into rclone-list-mouted
kachick 6fd0474
Omit to display garabage mount paths to support darwin
kachick 2993c8a
Change keybind to avoid darwin builtin
kachick f675d9a
Fix fzf become on darwin
kachick e6b73b9
Uninstall rclone in darwin
kachick 3310d85
Clarify paren for nix with
kachick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ pkgs, ... }: | ||
pkgs.writeShellApplication rec { | ||
name = "rclone-fzf"; | ||
text = builtins.readFile ./${name}.bash; | ||
runtimeInputs = with pkgs; [ | ||
fzf | ||
rclone | ||
my.rclone-mount | ||
my.rclone-list-mounted | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
if [ $# -ge 1 ]; then | ||
query="$1" | ||
else | ||
query="" | ||
fi | ||
|
||
# Don't use --preview for this. It omits some columns, and this will not be changed with selected entry | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And cannot copy from the preview window |
||
rclone-list-mounted >&2 | ||
|
||
# Don't use rclone in fzf --preview, it runs query and be slow | ||
rclone listremotes | fzf --query "$query" --border-label '☁️ Rclone Remotes' \ | ||
--layout=reverse --height=85% --min-height=20 --border \ | ||
--border-label-pos=2 \ | ||
--color='header:italic:underline,label:blue' \ | ||
--header $'Ctrl-/ (Mount) / Alt-A (Inspect)\n\n' \ | ||
--bind 'ctrl-/:become(rclone-mount {})' \ | ||
--bind 'alt-a:become(rclone about {})' \ | ||
--bind 'enter:become(echo {})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ pkgs, ... }: pkgs.writers.writeNuBin "rclone-list-mounted" (builtins.readFile ./script.nu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Don't use mount command to support darwin with same implementation | ||
ps --long | where name =~ rclone and command =~ mount | select pid ppid command | upsert command { |row| $row.command | parse --regex '\A\S+rclone\S+ mount (?<remote>\S+?:) (?P<local>\S+)' } | flatten -a | select remote local pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ pkgs, lib, ... }: | ||
pkgs.writeShellApplication rec { | ||
name = "rclone-mount"; | ||
text = builtins.readFile ./${name}.bash; | ||
runtimeInputs = with pkgs; [ | ||
coreutils # `mktemp` | ||
rclone | ||
]; | ||
# Didn't work on Darwin. It might work when disabling --daemon or replacing the default NFS with FUSE. However, I'm very tired to consider Darwin. | ||
meta.platforms = lib.platforms.linux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
rclone-mount() { | ||
local -r remote="$1" # e.g `foo:` | ||
# TODO: Return the path if already mounted the remote | ||
local -r mount_to="$(mktemp --tmpdir --directory "rclone.${remote%:}.XXXX")" | ||
# Use `kill``, not `kill -9`. If exists the garbages in `mount --types fuse.rclone`, `fusermount -u THE_PATH` | ||
# See https://www.reddit.com/r/rclone/comments/nh576p/how_to_stop_an_rclone_daemon/ | ||
rclone mount "$remote" "$mount_to" --vfs-cache-mode writes --daemon | ||
echo "$mount_to" | ||
} | ||
|
||
rclone-mount "$@" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still appeared in UI 🤔