Skip to main content

file-remark

Add a remark for the file in the OS.

项目地址

github: https://github.com/icexmoon/file-remark

gitee: https://gitee.com/icexmoon/file-remark

pypi: https://pypi.org/project/file-remark-icexmoon/

用途

这是一个可以给系统中的文件或路径添加备注的小工具。

特点有:

  • 使用绝对路径来匹配文件。
  • 独立数据存储,不依赖于文件的meta信息。
  • 本应用使用Python编写,适用于Windows和Linux。

缺点有:

  • 文件如果移动后,就无法关联到备注信息(后续可以考虑添加md5匹配的机制)。

目的

之所以我会开发这么个小工具,是因为有时候会遇到需要给安装程序备注一个激活码,或者给压缩包备注一个解压密码的情况,此时多数情况是不得不添加一个额外的txt文件来说明,不仅麻烦,还显得很多余。

当然我也有在网上搜索类似的工具,但没有找到,只找到一个可以在文件的meta信息中写入备注的工具,但这个工具有个缺点,如果文件被修改了,meta信息就会被重写,导致添加的备注丢失。

使用说明

安装(Windows)

pip install file-remark-icexmoon

安装(Linux)

[icexmoon@icexmoon bin]$ python -m pip install file-remark-icexmoon --user
[icexmoon@icexmoon file_remark]$ pyfr
-bash: /usr/local/bin/pyfr: 没有那个文件或目录
[icexmoon@icexmoon file_remark]$ sudo ln -s /home/icexmoon/.local/bin/pyfr /usr/local/bin/pyfr
[icexmoon@icexmoon file_remark]$ pyfr -v
当前软件版本:0.0.4
数据库版本:3

因为Linux下会有权限问题,所以最好使用pip xxx --user的方式仅为当前用户安装。此外通过这种方式安装后会将短命令pyfr创建到/home/icexmoon/.local/bin目录下,该目录一般不会列入PATH,所以还需要创建软链接。

更新

pip install file-remark-icexmoon --upgrade

显示当前目录下的文件和目录

pyfr

该命令可以同时显示已添加的文件备注和未添加备注的目录和文件。

比如:

❯ pyfr
- LICENSE [this is a license for open source]
- pyproject.toml [this is a test comment]
d src [this is a source directory]
- .git
- .vscode
d dist
- README.md
- setup.cfg
- setup.py
d tests

其中[xxx]是添加的备注信息。默认先显示有备注的文件,再显示其他的,但也可以使用其它参数修改显示结果。

开头的d或-是用来区分目录还是文件,这里使用的是Linux中的风格。

修改显示结果

可以使用多种参数修改显示结果:

  • -o或--only_remark:仅显示添加了备注的文件或目录。
  • -l或--remark_last:将由备注信息的条目显示在最后。

显示所有备注信息

可以显示所有已经添加的备注信息:

pyfr --all

添加备注

pyfr --add --file .\LICENSE --remark 'this is a license for open source'

或

pyfr -af .\LICENSE -r 'this is a license for open source'

-f参数后是需要添加备注的文件路径,可以使用相对路径或绝对路径。-r参数后是备注的内容,如果包含空白符需要使用引号包裹。

执行完毕后会自动打印当前目录下的条目以便查看添加结果。

目前只能添加备注,之后会增加修改备注和删除备注的功能。

修改备注

pyfr -mf xxx -r 'new file comment'

显示系统版本

pyfr -v

或

pyfr --version

初始化程序

pyfr --init_process

如果数据库损坏或遇到其它问题,可以使用此功能尝试重新初始化程序,但该操作将丢失已添加的所有数据。

删除备注

pyfr -d xxx

删除所有备注

pyfr --delete_all

更新日志

  • 0.0.1 基础版本。
  • 0.0.2 修改数据库表结构,添加显示版本功能。
  • 0.0.3 修复程序初始化会出错的bug。
  • 0.0.4 升级数据库到v3,输出信息中添加标识区分文件和目录
  • 0.0.5 添加修改备注功能,添加显示所有备注功能。
  • 0.0.6 添加删除备注的功能。
  • 0.0.7 修复了断开数据库连接时显示super对象没有__del__方法的bug。

Metadata

Release files for file-remark-icexmoon 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for file-remark-icexmoon 0.0.7
File Size Uploaded
file-remark-icexmoon-0.0.7.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for file-remark-icexmoon 0.0.7
File Interpreter ABI Platform
file_remark_icexmoon-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 33.7 kB

Release files / file-remark-icexmoon-0.0.7.tar.gz

Download URL file-remark-icexmoon-0.0.7.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2762ab7801f989469ad8673bdbe6126d9f434ae972139c997e0e1bde108ed98f
BLAKE2b-256 checksum
How to use checksums
8fb170e0a00c8efb5421cefa1cf0d23d2a8201e09950bbec9474436324bdc8df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.1

Release files / file_remark_icexmoon-0.0.7-py3-none-any.whl

Download URL file_remark_icexmoon-0.0.7-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0252c9200370adf7941ad3b5cf1ff4f2870ed1c3dd1f6de9dfa00ae601a10e1
BLAKE2b-256 checksum
How to use checksums
a9ed4b07e97cd461d7058c419a1bb6523eb7e9562a163c2ffa49c61ad6906335
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.1

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page