Skip to content

Commit ab80a31

Browse files
committed
Add sddf(Search & Delete Duplicated File) command.
1 parent bd16810 commit ab80a31

File tree

14 files changed

+463
-5
lines changed

14 files changed

+463
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mimixbox
88

99
# Test binary, built with `go test -c`. And test directory
1010
*.test
11+
*.sddf
1112

1213
# Output of the go coverage tool, specifically when used with LiteIDE
1314
*.out

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22
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).
3-
## [0.27.21] - 2021-12-07
3+
## [0.28.00] - 2021-12-08
4+
### Added
5+
- sddf command. Search & Delete Duplicated Files.
46
### Changed
57
- mimixbox command.
68
- When an error occurs, the name of the applet that caused the error is displayed.

cmd/mimixbox/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type options struct {
5454

5555
var osExit = os.Exit
5656

57-
const version = "0.27.21"
57+
const version = "0.28.0"
5858

5959
const (
6060
ExitSuccess int = iota // 0

docs/introduction/en/CommandAppletList.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
| path | Manipulate filename path|
2929
| rm | Remove file(s) or directory(s)|
3030
| rmdir | Remove directory|
31+
| sddf | Search & Delete Dupulicated File|
3132
| seq | Print the column of numbers|
3233
| serial | Rename the file to the name with a serial number|
3334
| sha1sum| Calculate or Check sercure hash 1 algorithm|

docs/man/sddf/en/sddf.1.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
% SDDF(1)
2+
% Naohiro CHIKAMATSU <[email protected]>
3+
% December 2021
4+
5+
# NAME
6+
7+
serial – Search & Delete Duplicatetd File
8+
9+
# SYNOPSIS
10+
11+
**sddf** [OPTIONS] PATH
12+
13+
# DESCRIPTION
14+
**sddf** looks for duplicate files under the specified directory and
15+
creates a list of them (default: duplicated-file.sddf).
16+
If the list is executed with sddf arguments, sddf delete the file based
17+
on the contents of the list.
18+
19+
# EXAMPLES
20+
**Search for duplicate files under the current directory**
21+
22+
$ sddf .
23+
24+
**Remove duplicate files**
25+
26+
$ sddf duplicated-file.sddf
27+
28+
# OPTIONS
29+
**-o, **--output**
30+
: Specify the file name of the duplicate file list.
31+
32+
**-h**, **--help**
33+
: Show help message.
34+
35+
**-v**, **--version**
36+
: Show sddf command version.
37+
38+
# EXIT VALUES
39+
**0**
40+
: Success
41+
42+
**1**
43+
: Error when specifying the argument of the sddf command, or error during file operation
44+
45+
# BUGS
46+
See GitHub Issues: https://github.com/nao1215/mimixbox/issues
47+
48+
# LICENSE
49+
The MimixBox project is licensed under the terms of the MIT license and Apache License 2.0.

docs/man/sddf/ja/sddf.1.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
% SDDF(1)
2+
% Naohiro CHIKAMATSU <[email protected]>
3+
% 2021年12月
4+
5+
# 名前
6+
7+
serial – 重複するファイルを探し、削除する
8+
9+
# 書式
10+
11+
**sddf** [OPTIONS] PATH
12+
13+
# 説明
14+
**sddf**は、任意のディレクトリ以下にある重複ファイルを探し出し、
15+
そのリスト(デフォルト:duplicated-file.sddf)を作成します。
16+
リストを指定して実行した場合は、リスト内容に基づいてファイルを削除します。
17+
18+
#
19+
**カレントディレクトリ以下から重複ファイルを探索**
20+
21+
$ sddf .
22+
23+
**重複ファイルを削除**
24+
25+
$ sddf duplicated-file.sddf
26+
27+
# オプション
28+
**-o, **--output**
29+
: 重複ファイルリストのファイル名を指定します。
30+
31+
**-h**, **--help**
32+
: ヘルプメッセージを表示します。
33+
34+
**-v**, **--version**
35+
: sddfコマンドのバージョンを表示します。
36+
37+
# 終了ステータス
38+
**0**
39+
: 成功
40+
41+
**1**
42+
: sddfコマンドの引数指定でエラー、もしくはファイル操作中のエラー
43+
44+
# バグ
45+
GitHub Issuesを参照してください。URL:https://github.com/nao1215/mimixbox/issues
46+
47+
# ライセンス
48+
MimixBoxプロジェクトは、MIT License条文およびApache License 2.0条文の下でライセンスされています。

go.mod

+7
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@ module github.com/nao1215/mimixbox
33
go 1.17
44

55
require (
6+
github.com/cheggaaa/pb/v3 v3.0.8
67
github.com/fogleman/gg v1.3.0
78
github.com/jessevdk/go-flags v1.5.0
89
github.com/stretchr/testify v1.7.0
910
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
1011
)
1112

1213
require (
14+
github.com/VividCortex/ewma v1.1.1 // indirect
1315
github.com/davecgh/go-spew v1.1.0 // indirect
16+
github.com/fatih/color v1.10.0 // indirect
1417
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
18+
github.com/mattn/go-colorable v0.1.8 // indirect
19+
github.com/mattn/go-isatty v0.0.12 // indirect
20+
github.com/mattn/go-runewidth v0.0.12 // indirect
1521
github.com/pmezard/go-difflib v1.0.0 // indirect
22+
github.com/rivo/uniseg v0.2.0 // indirect
1623
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
1724
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
1825
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect

go.sum

+18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1+
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
2+
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
3+
github.com/cheggaaa/pb/v3 v3.0.8 h1:bC8oemdChbke2FHIIGy9mn4DPJ2caZYQnfbRqwmdCoA=
4+
github.com/cheggaaa/pb/v3 v3.0.8/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/ow1EJTA=
15
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
26
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7+
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
8+
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
39
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
410
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
511
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
612
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
713
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
814
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
15+
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
16+
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
17+
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
18+
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
19+
github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow=
20+
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
921
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1022
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
23+
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
24+
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
25+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
1126
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
1227
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
1328
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1429
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
1530
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
31+
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
32+
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1633
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1734
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
35+
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1836
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
1937
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
2038
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=

internal/applets/applet.go

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
"github.com/nao1215/mimixbox/internal/applets/shellutils/ischroot"
4747
"github.com/nao1215/mimixbox/internal/applets/shellutils/mbsh"
4848
"github.com/nao1215/mimixbox/internal/applets/shellutils/path"
49+
"github.com/nao1215/mimixbox/internal/applets/shellutils/sddf"
4950
"github.com/nao1215/mimixbox/internal/applets/shellutils/seq"
5051
"github.com/nao1215/mimixbox/internal/applets/shellutils/serial"
5152
"github.com/nao1215/mimixbox/internal/applets/shellutils/sleep"
@@ -106,6 +107,7 @@ func init() {
106107
"path": {path.Run, "Manipulate filename path"},
107108
"rm": {rm.Run, "Remove file(s) or directory(s)"},
108109
"rmdir": {rmdir.Run, "Remove directory"},
110+
"sddf": {sddf.Run, "Search & Delete Duplicated File"},
109111
"serial": {serial.Run, "Rename the file to the name with a serial number"},
110112
"sha1sum": {sha1sum.Run, "alculate or Check sercure hash 1 algorithm"},
111113
"sha256sum": {sha256sum.Run, "alculate or Check sercure hash 256 algorithm"},

0 commit comments

Comments
 (0)