Skip to content

Commit

Permalink
Merge pull request #15 from b4b4r07/v2
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
b4b4r07 authored Jan 18, 2020
2 parents 83822ed + 2afaba4 commit a3d3099
Show file tree
Hide file tree
Showing 23 changed files with 426 additions and 1,957 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.12
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
28 changes: 28 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project_name: gomi
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:
- main: .
binary: gomi
ldflags:
- -s -w
- -X github.com/b4b4r07/gomi/main.Version={{.Version}}
- -X github.com/b4b4r07/gomi/main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: darwin
linux: linux
windows: windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
release:
prerelease: auto
163 changes: 7 additions & 156 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,174 +1,25 @@
[![](https://raw.githubusercontent.com/b4b4r07/screenshots/master/gomi/logo.png)][gomi]

[![](https://img.shields.io/badge/platform-OSX%20|%20Linux%20|%20Windows-ff69b4.svg?style=flat-square)][release]
[![](http://img.shields.io/github/release/b4b4r07/gomi.svg?style=flat-square)][release]
[![](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]
[![](http://img.shields.io/github/release/b4b4r07/gomi.svg?style=flat-square)][release] [![](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]

`gomi` is a simple trash tool that works on CLI, written in Go

## Description

The concept of the trashcan does not exist in Command-line interface ([CLI](http://en.wikipedia.org/wiki/Command-line_interface)). If you have deleted an important file by mistake with the `rm` command, it would be difficult to restore. Then, it's this `gomi`. Unlike `rm` command, it is possible to easily restore deleted files because `gomi` have the trashcan for the CLI. It is also possible to work with trashcan for Graphical user interface ([GUI](http://en.wikipedia.org/wiki/Graphical_user_interface)).

***DEMO:***

[![DEMO](https://raw.githubusercontent.com/b4b4r07/screenshots/master/gomi/demo.gif)][gomi]

\*1 *gomi* means a trash in Japanese.

\*2 It was heavily inspired by [peco/peco](https://github.com/peco/peco) and [mattn/gof](https://github.com/mattn/gof).

## Features

- Easy to restore (thanks to [`peco`](https://github.com/peco/peco)-like interface)
- Quick preview feature
- Customizes [TOML format](https://github.com/toml-lang/toml) configuration file
- Interacts nicely with [`Trash`](http://en.wikipedia.org/wiki/Trash_(computing))
- Supports [`Put Back`](http://www.mac-fusion.com/trash-tip-how-to-put-files-back-to-their-original-location/)
- A single binary
- Cross-platform CLI app

### Quick Look

Before you restore a file that was discarded from the trashcan, `gomi` has a function that browse the contents of the file. It is almost the same as the [Quick Look](http://en.wikipedia.org/wiki/Quick_Look) of OS X.
If the discarded file is a directory, it is recursively scan its contents and make the files and subdirectories list.

To QuickLook, type the <kbd>C-q</kbd> in Restore mode. Available key map is here: [Keymap](#keymap)

[![QuickLook](https://raw.githubusercontent.com/b4b4r07/screenshots/master/gomi/quicklook.png)][gomi]

### Put Back

`gomi` supports [`Put Back`](http://www.mac-fusion.com/trash-tip-how-to-put-files-back-to-their-original-location/). Because it is possible to combine the GUI trashcan with `gomi`, it is possible to restore the discard file from the GUI menu. Currently it has supported OS X only.

[![Put Back](https://raw.githubusercontent.com/b4b4r07/screenshots/master/gomi/putback.gif)][gomi]

### Works on Windows

`gomi` is a Cross-platform application. Basically, you can also use Windows. In the future, it will be possible to combine the Recycle Bin with `gomi`. We welcome your pull request.

[![Windows](https://raw.githubusercontent.com/b4b4r07/screenshots/master/gomi/windows.gif)][gomi]

## Usage

Basic usage is...

1. **Remove!** Throw away the trash :package:

$ gomi files

2. **Restore!** Scavenge the trash :mag:

$ gomi -r

It is able to replace `rm` with `gomi`. However, on the characteristics of it, it dosen't have options such as `-f` and `-i` at all. The available option is `-r`.

To actually delete rather than the trash:

$ gomi ~/.gomi/2015/05/01/gomi_file.13_55_01

Run twice.

To specify the location where you want to restore:

$ gomi -r .

In the above example, it's restored to the current directory.

For more information, see `gomi --help`.

### Keymap

| Keys | Actions |
|------|-------|
| Enter | Restore a file under the cursor or selected files |
| C-c, Esc | Exit from Restore mode or Quick Look mode with success status |
| C-n, Down | Move the selected line cursor to one line below |
| C-p, Up | Move the selected line cursor to one line above |
| C-f, Right | Move caret forward 1 character |
| C-b, Left | Move caret backward 1 character |
| C-a | Move caret to the beginning of line |
| C-e | Move caret to the end of line |
| BackSpace | Delete one character backward |
| C-u | Delete the characters under the cursor backward until the beginning of the line |
| C-w | Delete one word backward |
| C-l | Redraws the screen |
| C-q | Toggle Quick Look |
| C-i, Tab | Toggle showing help message about gomi |
| C-v | Select multiple lines |
| C-\_ | Remove a file under the cursor or selected files |

## Installation

The installation script requires bash 3+:

$ curl -L git.io/gomi | bash

If you want to go the Go way (install in GOPATH/bin) and just want the command:

$ go get -u github.com/b4b4r07/gomi/...

### Mac OS X / Homebrew

If you're on OS X and want to use [Homebrew](https://github.com/Homebrew/homebrew):

$ brew tap b4b4r07/gomi
$ brew install gomi

### Binary only

Otherwise, download the binary from [GitHub Releases][release] and drop it in your `$PATH`.
Download the binary from [GitHub Releases][release] and drop it in your `$PATH`.

- [OS X (386)](https://github.com/b4b4r07/gomi/releases/latest)
- [Linux (386)](https://github.com/b4b4r07/gomi/releases/latest)
- [Windows (386)](https://github.com/b4b4r07/gomi/releases/latest)
- [Darwin / Mac](https://github.com/b4b4r07/gomi/releases/latest)
- [Linux](https://github.com/b4b4r07/gomi/releases/latest)

## Setup

### Replace rm with gomi

Put something like this in your `~/.bashrc` or `~/.zshrc`:

```bash
alias rm="gomi"
```

This is recommended. By doing so, it is possible to prevent `rm` command from removing an important file.

### config.toml

`gomi` read the TOML configuration such as the following from the `~/.gomi/config.toml`. In ***ignore_files***, you can describe shell file name pattern that you do not want to add to history for restoration.

```toml
root = "~/.gomi"

# Interpret if name matches the shell file name pattern
ignore_files = [
".DS_Store",
"*~",
"unko",
]

gomi_size = 1000000000 # 1GB

```

## Versus Other Trash Tools
## Versus

- [andreafrancia/trash-cli](https://github.com/andreafrancia/trash-cli)

> Command line interface to the freedesktop.org trashcan.

- [sindresorhus/trash](https://github.com/sindresorhus/trash)

> Cross-platform command-line app for moving files and directories to the trash - A safer alternative to `rm`

:do_not_litter: Do not use litter, use [gomi][gomi].

## License

[MIT](license) © BABAROT (a.k.a. [b4b4r07](http://tellme.tokyo))
[MIT](license) (c) BABAROT (a.k.a. [b4b4r07](https://tellme.tokyo))

[release]: https://github.com/b4b4r07/gomi/releases
[license]: http://b4b4r07.mit-license.org
[gomi]: http://b4b4r07.com/gomi
[license]: https://b4b4r07.mit-license.org
Loading

0 comments on commit a3d3099

Please sign in to comment.