fuga 1.1.0

A CLI tool to operate files or directories in 2 steps.
Documentation
[![Crates.io](https://img.shields.io/crates/v/fuga)](https://crates.io/crates/fuga)
[![Crates.io](https://img.shields.io/crates/l/fuga)](https://github.com/liebe-magi/fuga/blob/main/LICENSE)
[![build](https://github.com/liebe-magi/fuga/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/liebe-magi/fuga/actions/workflows/build.yml)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

# ๐Ÿ“ฆ FUGA ๐Ÿ“ฆ

![logo](/res/logo_256.jpg)

A CLI tool to operate files or directories in 2 steps.

[ๆ—ฅๆœฌ่ชžใฎREADMEใฏใ“ใกใ‚‰](README_jp.md)

## ๐Ÿ“ฆ DESCRIPTION

- `fuga` is a CLI tool that performs file operations in two steps.
- Developed as an alternative to commands like `mv`, `cp`, and `ln`.
- Mark one or more files or directories using `fuga mark`, and then perform copy/move/link operations together after navigating to another directory.
- Save frequently used mark sets as presets and reload them later from the CLI or dashboard.
- Launching `fuga` without arguments opens an interactive dashboard TUI so you can browse, mark, and run copy/move/link actions without leaving the terminal.

## ๐Ÿ“ฆ INSTALLATION

### Pre-built Binaries

- Pre-built binaries for the following architectures are available on [releases](https://github.com/liebe-magi/fuga/releases).

  - aarch64-apple-darwin (Mac - Apple Chip)
  - x86_64-apple-darwin (Mac - Intel Chip)
  - x86_64-unknown-linux-gnu (Linux - Intel Chip)

- Place the binary for your architecture in a directory included in your system's PATH.

### Build with Cargo

- You can install `fuga` by building it using the `cargo` command.

```
cargo install fuga
```

### Verify Installation

- If the installation is successful, the version information can be displayed using the following command:

```
$ fuga -V
fuga v1.1.0
```

## ๐Ÿ“ฆ USAGE

> Running `fuga` without a subcommand launches the dashboard TUI. Use the subcommands below when you prefer scripted CLI flows.

```
A CLI tool to operate files or directories in 2 steps.

Usage: fuga <COMMAND>

Commands:
  mark        Manage the marked targets
  copy        Copy the marked targets
  move        Move the marked targets
  link        Make symbolic links to the marked targets
  completion  Generate the completion script
  preset      Manage mark presets
  version     Show the version of the tool
  help        Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
```

### Interactive Dashboard (TUI)

- Launch the dashboard by running `fuga` with no arguments.
- Browse the current directory, toggle hidden files with `.` or `Ctrl+h`, and filter entries with `/` plus fuzzy queries.
- Move the cursor with arrow keys or `j`/`k`, open directories with `Enter`/`l`, and return to the parent with `h` or `Backspace`.
- Press `m` or space to toggle marks, `Ctrl+r`/`R` to clear the mark list, and `?` to view the in-app help overlay.
- Open the preset loader with `P`, save the current marks with `S`, and delete presets from the popup with `D` or `x`.
- Exit with `c`, `v`, or `s` to copy, move, or link the marked targets into the directory you were browsing, or `q` to leave without changes.

### Managing Marked Targets

- Mark the files or directories you want to operate on with `fuga mark <PATH...>`.

```
$ fuga mark target_file.txt docs
โœ… : ๐Ÿ“„ /home/user/path/to/target_file.txt marked.
โœ… : ๐Ÿ“ /home/user/path/to/docs marked.
โ„น๏ธ  : Mark list now tracks 2 target(s).
```

- To add more paths without duplicating existing entries, use `fuga mark --add <PATH...>`.

```
$ fuga mark --add images/*.png
โœ… : ๐Ÿ“„ /home/user/path/to/images/banner.png added.
โœ… : ๐Ÿ“„ /home/user/path/to/images/logo.png added.
โ„น๏ธ  : Mark list now tracks 4 target(s).
```

- To list the currently marked targets, use `fuga mark --list`.

```
$ fuga mark --list
โ„น๏ธ  : Marked targets:
๐Ÿ“„ /home/user/path/to/target_file.txt
๐Ÿ“ /home/user/path/to/docs
๐Ÿ“„ /home/user/path/to/images/banner.png
๐Ÿ“„ /home/user/path/to/images/logo.png
```

- To clear all marked targets, use `fuga mark --reset`.

```
$ fuga mark --reset
โœ… : Marked targets cleared.
โ„น๏ธ  : Mark list now tracks 0 target(s).
```

### Managing Presets

- Save the current mark list as a preset with `fuga preset save <NAME>`.

```
$ fuga preset save photos
โœ… : Preset 'photos' saved with 3 target(s).
```

- Load the targets from a preset back into the mark list with `fuga preset load <NAME>`.

```
$ fuga preset load photos
โœ… : Preset 'photos' loaded. Mark list now tracks 3 target(s).
```

- Review stored presets with `fuga preset list`, inspect their contents via `fuga preset show <NAME>`, and remove obsolete entries with `fuga preset delete <NAME>`.

### File Operations

Three file operations are possible: `Copy`, `Move`, and `Symbolic Link creation`.

#### Copy

- Navigate to the destination directory and use `fuga copy` to copy all marked files or directories.

```
$ cd test_dir_copy

$ fuga copy
โ„น๏ธ  : Copying ๐Ÿ“„ /home/user/path/to/target_file.txt -> /current/dir/target_file.txt
โœ… : ๐Ÿ“„ /current/dir/target_file.txt copied.
โ„น๏ธ  : Copying ๐Ÿ“ /home/user/path/to/docs -> /current/dir/docs
โœ… : ๐Ÿ“ /current/dir/docs copied.
```

- You can also specify the destination directory, or a file name when exactly one target is marked.

```
$ fuga copy test_dir_copy
โ„น๏ธ  : Copying ๐Ÿ“„ /home/user/path/to/target_file.txt -> test_dir_copy/target_file.txt
โœ… : ๐Ÿ“„ test_dir_copy/target_file.txt copied.

$ fuga copy copy.txt
โ„น๏ธ  : Copying ๐Ÿ“„ /home/user/path/to/target_file.txt -> copy.txt
โœ… : ๐Ÿ“„ copy.txt copied.
```

#### Move

- Navigate to the destination directory and use `fuga move` to move the marked file or directory.

```
$ cd test_dir_move

$ fuga move
โ„น๏ธ  : Moving ๐Ÿ“„ /home/user/path/to/target_file.txt -> /current/dir/target_file.txt
โœ… : ๐Ÿ“„ /current/dir/target_file.txt moved.
โ„น๏ธ  : Moving ๐Ÿ“ /home/user/path/to/docs -> /current/dir/docs
โœ… : ๐Ÿ“ /current/dir/docs moved.
โ„น๏ธ  : Mark list cleared after move.
```

- Similar to copying, you can specify the destination directory or file name.

```
$ fuga move test_dir_move
โ„น๏ธ  : Moving ๐Ÿ“„ /home/user/path/to/target_file.txt -> test_dir_move/target_file.txt
โœ… : ๐Ÿ“„ test_dir_move/target_file.txt moved.

$ fuga move move.txt
โ„น๏ธ  : Moving ๐Ÿ“„ /home/user/path/to/target_file.txt -> move.txt
โœ… : ๐Ÿ“„ move.txt moved.
```

#### Symbolic Link

- Navigate to the directory where you want to create a symbolic link and use `fuga link` to create a symbolic link to the marked file or directory.

```
$ cd test_dir_link

$ fuga link
โ„น๏ธ  : Linking ๐Ÿ“„ /home/user/path/to/target_file.txt -> /current/dir/target_file.txt
โœ… : ๐Ÿ“„ /current/dir/target_file.txt linked.
```

- You can also specify the destination directory or file name for the symbolic link.

```
$ fuga link test_dir_link
โ„น๏ธ  : Linking ๐Ÿ“„ /home/user/path/to/target_file.txt -> test_dir_link/target_file.txt
โœ… : ๐Ÿ“„ test_dir_link/target_file.txt linked.

$ fuga link link.txt
โ„น๏ธ  : Linking ๐Ÿ“„ /home/user/path/to/target_file.txt -> link.txt
โœ… : ๐Ÿ“„ link.txt linked.
```

### Generating Completion Scripts

- Use `fuga completion <shell>` to output a script for command completion. It supports the following five shells:
  - bash
  - elvish
  - fish
  - powershell
  - zsh

```
# For fish
$ fuga completion fish > ~/.config/fish/completions/fuga.fish
```
## Contributors โœจ

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://hackfront.dev"><img src="https://avatars.githubusercontent.com/u/38152917?v=4?s=100" width="100px;" alt="ใ‚Šใƒผใน"/><br /><sub><b>ใ‚Šใƒผใน</b></sub></a><br /><a href="#projectManagement-liebe-magi" title="Project Management">๐Ÿ“†</a> <a href="https://github.com/liebe-magi/fuga/pulls?q=is%3Apr+reviewed-by%3Aliebe-magi" title="Reviewed Pull Requests">๐Ÿ‘€</a> <a href="https://github.com/liebe-magi/fuga/commits?author=liebe-magi" title="Code">๐Ÿ’ป</a> <a href="https://github.com/liebe-magi/fuga/commits?author=liebe-magi" title="Documentation">๐Ÿ“–</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!