Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nnbnh/terminal-explorer
๐ Bring file manager's copy/paste to the CLI
https://github.com/nnbnh/terminal-explorer
basher bpkg cli clipboard copy-paste file-manager posix symlink terminal
Last synced: 3 months ago
JSON representation
๐ Bring file manager's copy/paste to the CLI
- Host: GitHub
- URL: https://github.com/nnbnh/terminal-explorer
- Owner: NNBnh
- License: gpl-3.0
- Created: 2021-01-30T13:47:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-09T05:45:29.000Z (over 2 years ago)
- Last Synced: 2023-03-05T22:43:20.811Z (almost 2 years ago)
- Topics: basher, bpkg, cli, clipboard, copy-paste, file-manager, posix, symlink, terminal
- Language: Shell
- Homepage:
- Size: 82 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> **๐ข [Check out the alternative flexible approach!](https://github.com/NNBnh/dotfiles/wiki/files-manager#-copy-cut-link-delete-and-rename-items)**
Terminal Explorer
Bring file manager's copy/paste to the CLI
## ๐ก About
**Terminal explorer** is a files manager tool written in [`portable sh`](https://github.com/dylanaraps/pure-sh-bible) that mimics the way GUI's file manager do copy/cut/paste.
## โจ Features
- **Minimum**: with exactly [**269** lines of `sh`](https://github.com/NNBnh/terminal-explorer/blob/main/bin/te) and [minimum dependencies](#dependencies).
- **Register**: you can operate in any specific register.
- **Smart cut**: after cutting the file to a new path, the file's new path will be automatically copied for future operation.
- **Customizable**: you can change the commands to set/get the clipboard, commands to copy/cut files, see more [here](#configuration).## ๐ Setup
### ๐งพ Dependencies
- [Unix commands](https://en.wikipedia.org/wiki/List_of_Unix_commands) to process
- A clipboard managers like:
- [`clipb`](https://github.com/NNBnh/clipb) clipboard managers warper
- [`wl-clipboard`](https://github.com/bugaevc/wl-clipboard) for [Wayland](https://wayland.freedesktop.org)
- [`xclip`](https://github.com/astrand/xclip) or [`xsel`](http://www.kfish.org/software/xsel) for [X.org](https://www.x.org)### ๐ฅ Installation
#### ๐ง Manually
Option 1: using `curl`
```sh
curl https://raw.githubusercontent.com/NNBnh/terminal-explorer/main/bin/te > ~/.local/bin/te
chmod +x ~/.local/bin/te
```Option 2: using `git`
```sh
git clone https://github.com/NNBnh/terminal-explorer.git ~/.local/share/terminal-explorer
ln -s ~/.local/share/terminal-explorer/bin/te ~/.local/bin/te
```#### ๐ฆ Package manager
For [Bpkg](https://github.com/bpkg/bpkg) user:
```sh
bpkg install NNBnh/terminal-explorer
```For [Basher](https://github.com/basherpm/basher) user:
```sh
basher install NNBnh/terminal-explorer
```> **Note** *If you can and want to port Terminal explorer to other package managers, feel free to do so.*
## โจ๏ธ Usage
Run `te` in the terminal:
```sh
te ACTION[REGISTER] FILES
```or:
```sh
te PASTE[REGISTER] [COMMAND]
``````console
ACTION:
c, y copy FILES into REGISTER's clipboard and set paste's action to copy
x, d copy FILES into REGISTER's clipboard and set paste's action to cut
l, s copy FILES into REGISTER's clipboard and set paste's action to symlink
h copy FILES into REGISTER's clipboard and set paste's action to hardlink
``````console
PASTE:
v, V, p, P paste FILES from REGISTER's clipboard, using custom COMMAND if defined
C, Y ignore paste's action, copy FILES from REGISTER's clipboard
X, D ignore paste's action, cut FILES from REGISTER's clipboard
L, S ignore paste's action, symlink FILES from REGISTER's clipboard
H ignore paste's action, hardlink FILES from REGISTER's clipboard
``````console
REGISTER if leave empty will use system clipboard,
otherwise it's name can be anything that doesn't include '/'.
```Examples:
```console
~/
โโ 1/
โโ 2/
โโ foo
โโ bar
``````sh
cd ~/
te x foo # Cut foo
te ctest bar # Copy bar to 'test' registercd ~/1/
te p # Paste foo then copy ~/1/foo
te ptest # Paste bar from 'test' register
te ptest # Paste bar from 'test' register againcd ~/2/
te p # Paste foo from ~/1/foo
```Result:
```console
~/
โโ 1/
โ โโ foo
โ โโ bar
โ โโ bar (2)
โ
โโ 2/
โ โโ foo
โ
โโ bar
```## โ๏ธ Configuration
Terminal explorer is configured through environment variables: `export TERMINALEXPLORER_=""`
|Value|Validity|Default|Description|
|-|-|-|-|
|`TERMINALEXPLORER_CLIPBOARD_SET_COMMAND`|``|`clipb copy`|Command to set the clipboard|
|`TERMINALEXPLORER_CLIPBOARD_GET_COMMAND`|``|`clipb paste`|Command to get the clipboard|
|`TERMINALEXPLORER_COPY_COMMAND`|``|`cp`|Command to copy files|
|`TERMINALEXPLORER_CUT_COMMAND`|``|`mv`|Command to cut files|
|||||
|`TERMINALEXPLORER_TEMPORARY`|``|`/tmp/terminal-explorer`|Temporary file's location|Examples:
```sh
export TERMINALEXPLORER_CLIPBOARD_SET_COMMAND='xclip -in -selection clipboard'
export TERMINALEXPLORER_CLIPBOARD_GET_COMMAND='xclip -out -selection clipboard'
export TERMINALEXPLORER_COPY_COMMAND='rsync --recursive --archive -hh --partial --info=stats1 --info=progress2 --modify-window=1'
export TERMINALEXPLORER_CUT_COMMAND='rsync --recursive --archive -hh --partial --info=stats1 --info=progress2 --modify-window=1 --remove-source-files'
```## ๐ Credits
Special thanks to:
- [**File URI Specification**](https://www.freedesktop.org/wiki/Specifications/file-uri-spec) by [Freedesktop.org](https://www.freedesktop.org)
- [**SH-realpath**](https://github.com/mkropat/sh-realpath) by [Michael Kropat](https://github.com/mkropat)
---
>
Made with โค๏ธ by NNB
>
>