Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
trash-cli - Command Line Interface to FreeDesktop.org Trash.
trash-cli - Command Line Interface to FreeDesktop.org Trash
============================================================

|Downloads|
Expand Down Expand Up @@ -56,7 +56,7 @@ Restore a trashed file while overwriting existing files::
$ echo "original">foo
$ ls
foo
$ trash foo
$ trash-put foo
$ echo "new">foo
$ trash-restore --overwrite
0 2022-11-01 22:15:00 /home/andrea/foo
Expand Down Expand Up @@ -142,13 +142,13 @@ alias::
Note that Bash aliases are used only in interactive shells, so using
this alias should not interfere with scripts that expect to use `rm`.

Where the trashed files go?
Where do the trashed files go?
~~~~~~~~~~~~~~~~~~~~~~~~~~~
File trashed from the home partition will be moved here::

~/.local/share/Trash/

How to auto delete files older that 30 days?
How to auto delete files older than 30 days?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run this::

Expand All @@ -164,7 +164,7 @@ The easy way
~~~~~~~~~~~~

Requirements:
* Python 3 (Python 2.7 also work)
* Python 3 (Python 2.7 also works)
* pipx_ (optional, to install in a clean environment)

If pipx is available::
Expand All @@ -175,7 +175,7 @@ Alternatively, install with vanilla pip::

pip install trash-cli

Note: you may want add ~/.local/bin to the PATH::
Note: you may want to add ~/.local/bin to the PATH::

echo 'export PATH="$PATH":~/.local/bin' >> ~/.bashrc
source ~/.bashrc # reload .bashrc
Expand All @@ -202,7 +202,7 @@ Then install the latest version from git::

$ [sudo] pip install git+https://github.com/andreafrancia/trash-cli

After the user installation you may want add this line to your .bashrc/.zshrc::
After the user installation you may want to add this line to your .bashrc/.zshrc::

export PATH=~/.local/bin:"$PATH"

Expand Down Expand Up @@ -230,7 +230,7 @@ MacOS (Homebrew)::
Install shell completions
~~~~~~~~~~~~~~~~~~~~~~~~~

You need install by::
You need to install by::

pipx install 'trash-cli[completion]'

Expand All @@ -247,17 +247,16 @@ Then::
$cmd --print-completion tcsh | sudo tee /etc/profile.d/$cmd.completion.csh
done

Missing support for BRTFS volumes
Missing support for Btrfs volumes
---------------------------------
trash-cli does not support BRTFS volumes.
trash-cli does not support Btrfs volumes.
I don't have any system nor time and/or knowledge to implement this kind of support.

If you need a trash implementation that you can checkout the `rmw`_ project.
If you need a trash implementation, you can check out the `rmw`_ project.

.. _rmw: https://github.com/theimpossibleastronaut/rmw

If you want, can and know how to add support to BRTFS with sensible automation
tests please send a pull request.
If you want to, and can, and know how to add support for Btrfs with sensible automation tests, please send a pull request.

Bugs
----
Expand Down
188 changes: 149 additions & 39 deletions README_zh-CN.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trash-cli 提供以下命令:

::

$ trash-put
$ trash-put foo

列出回收站文件:

Expand All @@ -46,7 +46,7 @@ trash-cli 提供以下命令:
2007-08-30 12:36:00 /home/andrea/foo
2007-08-30 12:39:41 /home/andrea/foo

恢复回收站文件
恢复一个回收站文件

::

Expand All @@ -60,17 +60,45 @@ trash-cli 提供以下命令:
$ ls foo
foo

恢复一个回收站文件并且覆盖已存在的文件:

::

$ echo "original">foo
$ ls
foo
$ trash-put foo
$ echo "new">foo
$ trash-restore --overwrite
0 2022-11-01 22:15:00 /home/andrea/foo
What file to restore [0..0]: 0
$ cat foo
original

通过','(逗号)分隔文件以恢复多个回收站文件。也支持范围:

::

$ trash-restore
0 2007-08-30 12:36:00 /home/andrea/foo
1 2007-08-30 12:39:41 /home/andrea/bar
2 2007-08-30 12:39:41 /home/andrea/bar2
3 2007-08-30 12:39:41 /home/andrea/foo2
What file to restore [0..3]: 0-2, 3
$ ls foo bar bar2 foo2
foo bar bar2 foo2

删除所有回收站文件:

::

$ trash-empty

删除回收站中 n 天前被回收的文件:
删除回收站中 <n> 天前被回收的文件:

::

$ trash-empty <days>
$ trash-empty <n>

示例:

Expand Down Expand Up @@ -148,6 +176,17 @@ trash-cli 提供以下命令:

~/.local/share/Trash/

怎么自动删除回收站30天前的文件?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

运行以下命令:

::

(crontab -l ; echo "@daily $(which trash-empty) 30") | crontab -

这会更新你的 crontab 文件,添加一个每天运行的 `trash-empty` 命令来删除30天前的文件。要查看你的 crontab,请使用:`crontab -l`

安装
----

Expand All @@ -157,66 +196,127 @@ trash-cli 提供以下命令:
要求:

- Python 3 (Python 2.7 也可以)
- pip (在 Debian 上用 `apt-get install python-pip` 来安装 pip)
- pipx_ (可选,推荐,安装在虚拟环境中以保护系统环境)
- pipx_ (可选,为了在干净的环境中安装)

安装命令:
如果 pipx 可用:

::

pipx install trash-cli
# 或者
pip install trash-cli
pipx install trash-cli

源码安装
~~~~~~~~
此外, 用原版 pip 安装

::

pip install trash-cli

为所有用户安装
注意:你可能想添加 ~/.local/bin 到你的 PATH 环境变量中

::

git clone https://github.com/andreafrancia/trash-cli.git
cd trash-cli
sudo pip install .
echo 'export PATH="$PATH":~/.local/bin' >> ~/.bashrc
source ~/.bashrc # reload .bashrc

为当前用户安装:
卸载命令:

::

pipx uninstall trash-cli
# 或者
pip uninstall trash-cli

最新版本(源码安装)
~~~~~~~~~~~~~~~~~~
首先你要卸载任何之前安装的 trash-cli 版本

::

git clone https://github.com/andreafrancia/trash-cli.git
cd trash-cli
pip install .
$ [sudo] pip uninstall trash-cli # remove the previous version (with pip)
$ [sudo] apt-get remove trash-cli # remove the previous version (with apt)
$ [sudo] yum uninstall trash-cli # remove the previous version (with yum)
$ ... # 取决于你使用的发行版的包管理器

为当前用户安装后你可能需要把以下代码添加到 .bashrc:
然后从 git 安装最新版本

::

export PATH=~/.local/bin:"$PATH"
$ [sudo] pip install git+https://github.com/andreafrancia/trash-cli

卸载命令
在用户安装后,你可能想把以下代码添加到 .bashrc/.zshrc

::

pipx uninstall trash-cli
# 或者
pip uninstall trash-cli
export PATH=~/.local/bin:"$PATH"

用包管理器安装
~~~~~~~~~~~~~~
从包管理器安装
~~~~~~~~~~~~~~~~~~~~

Debian/Ubuntu (apt)::

sudo apt install trash-cli

反馈与 Bug 报告
---------------
Arch Linux (pacman)::

sudo pacman -S trash-cli

Fedora (dnf)::

sudo dnf install trash-cli

MacOS (Homebrew)::

brew install trash-cli
echo 'export PATH="~/homebrew/opt/trash-cli/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

安装 shell 补全
~~~~~~~~~~~~~~~~~~~~~~~~~

你需要通过以下命令安装

::

pipx install 'trash-cli[completion]'

或者

::

pip install 'trash-cli[completion]'

然后

::

cmds=(trash-empty trash-list trash-restore trash-put trash)
for cmd in ${cmds[@]}; do
$cmd --print-completion bash | sudo tee /usr/share/bash-completion/completions/$cmd
$cmd --print-completion zsh | sudo tee /usr/share/zsh/site-functions/_$cmd
$cmd --print-completion tcsh | sudo tee /etc/profile.d/$cmd.completion.csh
done

缺乏对 Btrfs 卷的支持
---------------------------------
trash-cli 不支持 Btrfs 卷。
我没有相关系统,时间和/或知识来实现这样的支持。

如果你需要一个回收站实现,请查看 `rmw`_ 项目。

.. _rmw: https://github.com/theimpossibleastronaut/rmw

如果你发现了 bug,请在这里报告:
如果你想、可以并且知道如何添加对 Btrfs 的支持,并且有合理的自动化测试,请发送一个 pull request。

https://github.com/andreafrancia/trash-cli/issues
Bugs
----

如果你发现一个 bug 请在这里报告:

https://github.com/andreafrancia/trash-cli/issues

反馈
--------

你也可以给我发邮件 andrea@andreafrancia.it\ 。我的推特帐号是
@andreafrancia。
你可以通过 andrea@andreafrancia.it 发给我邮件.

开发
----
Expand All @@ -225,19 +325,29 @@ Debian/Ubuntu (apt)::

::

virtualenv env --no-site-packages
source env/bin/activate
pip install -r requirements-dev.txt
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt -r requirements.txt

运行测试:

::

pytest -m 'not slow' # 只运行单元测试
pytest -m 'slow' # 运行所有集成测试
pytest -m 'not slow' # 只运行快测试
pytest -m 'slow' # 运行慢测试
pytest # 运行所有测试

感谢
------
感谢通过 Paypal 捐献的捐赠者.

感谢 `项目贡献者`_.

感谢 `JetBrains`_ 为开源开发提供的许可证。

.. |Donate| image:: https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif
.. _Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=93L6PYT4WBN5A
.. _English: https://github.com/andreafrancia/trash-cli/blob/master/README.rst
.. _pipx: https://pypa.github.io/pipx
.. _项目贡献者: https://github.com/andreafrancia/trash-cli/graphs/contributors
.. _JetBrains: https://jb.gg/OpenSource
Loading