Skip to content

Commit

Permalink
rclone-tui: Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
darkhz committed Dec 15, 2022
0 parents commit 9a9dda9
Show file tree
Hide file tree
Showing 35 changed files with 7,304 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
project_name: rclone-tui

builds:
- env:
- CGO_ENABLED=0
- GO111MODULE=on
- GOPROXY=https://proxy.golang.org

goos:
- linux
- darwin
- windows

goarch:
- arm
- 386
- arm64
- amd64

goarm:
- 5
- 6
- 7

ignore:
- goos: windows
goarch: arm64

- goos: windows
goarch: arm

archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64

format_overrides:
- goos: windows
format: zip

files:
- LICENSE

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
skip: true
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2022 darkhz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

124 changes: 124 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/darkhz/rclone-tui)](https://goreportcard.com/report/github.com/darkhz/rclone-tui)

[![youtube](https://img.youtube.com/vi/Jmm55Jh5Nhc/1.jpg)](https://youtube.com/watch?v=Jmm55Jh5Nhc)

# rclone-tui
rclone-tui is a cross-platform manager for rclone. It aims to be on-par with the web GUI (--rc-web-gui) as well as provide more improvements and enhancements over its general functionality.

Click on the above thumbnail to watch the demo video.
## Features
- Monitor rclone stats via the dashboard
- Create, update, view and delete configurations
- Explore remotes and perform various operations
- Mount and unmount remotes
- View file transfer and progress information

## Installation
You can download the binaries present in the **Releases** page. <br /><br />
Alternatively, if the **go** compiler is present in your system, you can install it with the following command:<br />
`go install github.com/darkhz/rclone-tui@latest`

## Usage
```
rclone-tui [<flags>]
Flags:
--page Load the specified page (one of dashboard, configuration, explorer, mounts).
--host Specify a rclone host to connect to.
--password Specify a login password.
--user Specify a login username.
```

## Keybindings

### Application

#### Global
|Operation |Keybinding |
|----------------------------|----------------------------|
|Open job manager |<kbd>Ctrl</kbd>+<kbd>j</kbd>|
|Show view switcher |<kbd>Ctrl</kbd>+<kbd>n</kbd>|
|Cancel currently loading job|<kbd>Ctrl</kbd>+<kbd>x</kbd>|
|Suspend |<kbd>Ctrl</kbd>+<kbd>z</kbd>|
|Quit |<kbd>Ctrl</kbd>+<kbd>q</kbd>|

#### Configuration/Mounts only
|Operation |Keybinding |
|-------------------------------------|-------------------------------------------------|
|Select button |<kbd>Enter</kbd> |
|Move between buttons |<kbd>Ctrl</kbd>+<kbd>Left/Right</kbd> |
|Move between sections (wizard only) |<kbd>Shift</kbd>+<kbd>Tab</kbd> |
|Move between form items (wizard only)|<kbd>Ctrl</kbd>+<kbd>Down/Up</kbd>/<kbd>Tab</kbd>|
|Show form options |<kbd>Ctrl</kbd>+<kbd>o</kbd> |
|Toggle password display |<kbd>Ctrl</kbd>+<kbd>p</kbd> |

### Configuration
#### Manager
|Operation |Keybinding |
|----------|------------|
|Create new|<kbd>n</kbd>|
|Update |<kbd>u</kbd>|
|Delete |<kbd>d</kbd>|
|Filter |<kbd>/</kbd>|

#### Wizard
|Operation |Keybinding |
|--------------|----------------------------|
|Jump to option|<kbd>Ctrl</kbd>+<kbd>f</kbd>|
|Save |<kbd>Ctrl</kbd>+<kbd>s</kbd>|
|Cancel |<kbd>Ctrl</kbd>+<kbd>c</kbd>|

### Explorer

#### General
|Operation |Keybinding |
|----------------------------|----------------------------|
|Switch between panes |<kbd>Tab</kbd> |
|Show remotes |<kbd>g</kbd> |
|Filter entries within pane |<kbd>/</kbd> |
|Sort entries within pane |<kbd>,</kbd> |
|Navigate between directories|<kbd>Left/Right</kbd> |
|Refresh a pane |<kbd>Ctrl</kbd>+<kbd>r</kbd>|
|Cancel fetching remotes |<kbd>Ctrl</kbd>+<kbd>x</kbd>|

#### Item selection
|Operation |Keybinding |
|-----------------|-----------------|
|Select one item |<kbd>Space</kbd> |
|Inverse selection|<kbd>a</kbd> |
|Select all items |<kbd>A</kbd> |
|Clear selections |<kbd>Escape</kbd>|

#### Operations
|Operation |Keybinding |
|-----------------------------|------------|
|Copy selected items |<kbd>p</kbd>|
|Move selected items |<kbd>m</kbd>|
|Delete selected items |<kbd>d</kbd>|
|Make directory |<kbd>M</kbd>|
|Generate public link for item|<kbd>;</kbd>|

### Mounts

#### Manager
|Operation |Keybinding |
|-----------|------------|
|Create new |<kbd>n</kbd>|
|Unmount |<kbd>u</kbd>|
|Unmount all|<kbd>U</kbd>|

#### Wizard
|Operation |Keybinding |
|-----------------|----------------------------|
|Create mountpoint|<kbd>Ctrl</kbd>+<kbd>s</kbd>|
|Cancel |<kbd>Ctrl</kbd>+<kbd>c</kbd>|

### Job Manager
|Operation |Keybinding |
|---------------------|----------------------------|
|Navigate between jobs|<kbd>Down/Up</kbd> |
|Cancel job |<kbd>x</kbd> |
|Cancel job group |<kbd>Ctrl</kbd>+<kbd>x</kbd>|

## Additional Notes
- To control your local rclone instance, launch `rclone rcd --rc-no-auth` and use the output host and port to login. Optionally, you can include authentication credentials with `--rc-user` and `--rc-pass` and excluding the `--rc-no-auth` flag.
89 changes: 89 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package cmd

import (
"fmt"
"os"
"path/filepath"
)

var (
configPath string
configProperties map[string]string
)

// SetupConfig checks for the config directory,
// and creates one if it doesn't exist.
func SetupConfig() error {
var dotConfigExists bool

homedir, err := os.UserHomeDir()
if err != nil {
return err
}

configProperties = make(map[string]string)
configDirs := []string{".config/rclone-tui", ".rclone-tui"}

for i, dir := range configDirs {
fullpath := filepath.Join(homedir, dir)
configDirs[i] = fullpath

if _, err := os.Stat(fullpath); err == nil {
configPath = fullpath
return nil
}

if i == 0 {
if _, err := os.Stat(
filepath.Clean(filepath.Dir(fullpath)),
); err == nil {
dotConfigExists = true
}
}
}

if configPath == "" {
if dotConfigExists {
err := os.Mkdir(configDirs[0], 0700)
if err != nil {
return fmt.Errorf("Cannot create %s", configDirs[0])
}

configPath = configDirs[0]
} else {
err := os.Mkdir(configDirs[1], 0700)
if err != nil {
return fmt.Errorf("Cannot create %s", configDirs[1])
}

configPath = configDirs[1]
}
}

return nil
}

// ConfigPath returns the absolute path for the given configType.
func ConfigPath(configType string) (string, error) {
confPath := filepath.Join(configPath, configType)

if _, err := os.Stat(confPath); err != nil {
fd, err := os.Create(confPath)
fd.Close()
if err != nil {
return "", fmt.Errorf("Cannot create "+configType+" file at %s", confPath)
}
}

return confPath, nil
}

// GetConfigProperty returns the value for the given property.
func GetConfigProperty(property string) string {
return configProperties[property]
}

// AddConfigProperty adds a property and its value to the properties store.
func AddConfigProperty(property, value string) {
configProperties[property] = value
}
Loading

0 comments on commit 9a9dda9

Please sign in to comment.