Skip to content

Commit

Permalink
Add sddf(Search & Delete Duplicated File) command.
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed Dec 8, 2021
1 parent bd16810 commit ab80a31
Show file tree
Hide file tree
Showing 14 changed files with 463 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mimixbox

# Test binary, built with `go test -c`. And test directory
*.test
*.sddf

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.27.21] - 2021-12-07
## [0.28.00] - 2021-12-08
### Added
- sddf command. Search & Delete Duplicated Files.
### Changed
- mimixbox command.
- When an error occurs, the name of the applet that caused the error is displayed.
Expand Down
2 changes: 1 addition & 1 deletion cmd/mimixbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type options struct {

var osExit = os.Exit

const version = "0.27.21"
const version = "0.28.0"

const (
ExitSuccess int = iota // 0
Expand Down
1 change: 1 addition & 0 deletions docs/introduction/en/CommandAppletList.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
| path | Manipulate filename path|
| rm | Remove file(s) or directory(s)|
| rmdir | Remove directory|
| sddf | Search & Delete Dupulicated File|
| seq | Print the column of numbers|
| serial | Rename the file to the name with a serial number|
| sha1sum| Calculate or Check sercure hash 1 algorithm|
Expand Down
49 changes: 49 additions & 0 deletions docs/man/sddf/en/sddf.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
% SDDF(1)
% Naohiro CHIKAMATSU <n.chika156@gmail.com>
% December 2021

# NAME

serial – Search & Delete Duplicatetd File

# SYNOPSIS

**sddf** [OPTIONS] PATH

# DESCRIPTION
**sddf** looks for duplicate files under the specified directory and
creates a list of them (default: duplicated-file.sddf).
If the list is executed with sddf arguments, sddf delete the file based
on the contents of the list.

# EXAMPLES
**Search for duplicate files under the current directory**

$ sddf .

**Remove duplicate files**

$ sddf duplicated-file.sddf

# OPTIONS
**-o, **--output**
: Specify the file name of the duplicate file list.

**-h**, **--help**
: Show help message.

**-v**, **--version**
: Show sddf command version.

# EXIT VALUES
**0**
: Success

**1**
: Error when specifying the argument of the sddf command, or error during file operation

# BUGS
See GitHub Issues: https://github.com/nao1215/mimixbox/issues

# LICENSE
The MimixBox project is licensed under the terms of the MIT license and Apache License 2.0.
48 changes: 48 additions & 0 deletions docs/man/sddf/ja/sddf.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
% SDDF(1)
% Naohiro CHIKAMATSU <n.chika156@gmail.com>
% 2021年12月

# 名前

serial – 重複するファイルを探し、削除する

# 書式

**sddf** [OPTIONS] PATH

# 説明
**sddf**は、任意のディレクトリ以下にある重複ファイルを探し出し、
そのリスト(デフォルト:duplicated-file.sddf)を作成します。
リストを指定して実行した場合は、リスト内容に基づいてファイルを削除します。

#
**カレントディレクトリ以下から重複ファイルを探索**

$ sddf .

**重複ファイルを削除**

$ sddf duplicated-file.sddf

# オプション
**-o, **--output**
: 重複ファイルリストのファイル名を指定します。

**-h**, **--help**
: ヘルプメッセージを表示します。

**-v**, **--version**
: sddfコマンドのバージョンを表示します。

# 終了ステータス
**0**
: 成功

**1**
: sddfコマンドの引数指定でエラー、もしくはファイル操作中のエラー

# バグ
GitHub Issuesを参照してください。URL:https://github.com/nao1215/mimixbox/issues

# ライセンス
MimixBoxプロジェクトは、MIT License条文およびApache License 2.0条文の下でライセンスされています。
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@ module github.com/nao1215/mimixbox
go 1.17

require (
github.com/cheggaaa/pb/v3 v3.0.8
github.com/fogleman/gg v1.3.0
github.com/jessevdk/go-flags v1.5.0
github.com/stretchr/testify v1.7.0
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
)

require (
github.com/VividCortex/ewma v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-runewidth v0.0.12 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
Expand Down
18 changes: 18 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
github.com/cheggaaa/pb/v3 v3.0.8 h1:bC8oemdChbke2FHIIGy9mn4DPJ2caZYQnfbRqwmdCoA=
github.com/cheggaaa/pb/v3 v3.0.8/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/ow1EJTA=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
Expand Down
2 changes: 2 additions & 0 deletions internal/applets/applet.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/nao1215/mimixbox/internal/applets/shellutils/ischroot"
"github.com/nao1215/mimixbox/internal/applets/shellutils/mbsh"
"github.com/nao1215/mimixbox/internal/applets/shellutils/path"
"github.com/nao1215/mimixbox/internal/applets/shellutils/sddf"
"github.com/nao1215/mimixbox/internal/applets/shellutils/seq"
"github.com/nao1215/mimixbox/internal/applets/shellutils/serial"
"github.com/nao1215/mimixbox/internal/applets/shellutils/sleep"
Expand Down Expand Up @@ -106,6 +107,7 @@ func init() {
"path": {path.Run, "Manipulate filename path"},
"rm": {rm.Run, "Remove file(s) or directory(s)"},
"rmdir": {rmdir.Run, "Remove directory"},
"sddf": {sddf.Run, "Search & Delete Duplicated File"},
"serial": {serial.Run, "Rename the file to the name with a serial number"},
"sha1sum": {sha1sum.Run, "alculate or Check sercure hash 1 algorithm"},
"sha256sum": {sha256sum.Run, "alculate or Check sercure hash 256 algorithm"},
Expand Down
Loading

0 comments on commit ab80a31

Please sign in to comment.