megfile icon indicating copy to clipboard operation
megfile copied to clipboard

feat: aliases for SmartPath

Open bbtfr opened this issue 1 year ago • 3 comments

新增对 alias 的支持,并加上了 megfile config alias 来配置

已知问题:

  1. CLI 有个不兼容更新
    • megfile config s3 上 -s 参数被调整为 -as,因为新增一个 -sv / --signature-version,感觉有歧义
    • 考虑到 -s 这块用法甚至没写到 readme 上,要不就偷偷改了算了
  2. 对 alias 的支持比较有限,有些地方的行为可能并不符合预期,例如 smart_glob 等返回路径的 API 目前返回的是原本的路径
  3. 期望能支持像 rclone 那样,对 prefix 的 alias,例如:sub => /path/to/dir,sub://foo => /path/to/dir/foo
    • 这要求 parent / parents 别出 prefix 定义的作用范围,目前还没实现

bbtfr avatar Aug 31 '24 05:08 bbtfr

Codecov Report

Attention: Patch coverage is 96.77419% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.42%. Comparing base (e92ff9f) to head (6329e95). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
megfile/cli.py 94.59% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #406      +/-   ##
==========================================
- Coverage   96.45%   96.42%   -0.03%     
==========================================
  Files          44       44              
  Lines        6120     6159      +39     
==========================================
+ Hits         5903     5939      +36     
- Misses        217      220       +3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 31 '24 05:08 codecov[bot]

总算都过了 😂 费了老鼻子劲

bbtfr avatar Aug 31 '24 07:08 bbtfr

新增对 alias 的支持,并加上了 megfile config alias 来配置

已知问题:

  1. CLI 有个不兼容更新

    • megfile config s3 上 -s 参数被调整为 -as,因为新增一个 -sv / --signature-version,感觉有歧义
    • 考虑到 -s 这块用法甚至没写到 readme 上,要不就偷偷改了算了
  2. 对 alias 的支持比较有限,有些地方的行为可能并不符合预期,例如 smart_glob 等返回路径的 API 目前返回的是原本的路径

  3. 期望能支持像 rclone 那样,对 prefix 的 alias,例如:sub => /path/to/dir,sub://foo => /path/to/dir/foo

    • 这要求 parent / parents 别出 prefix 定义的作用范围,目前还没实现

嗯,1 偷偷改就行;2 确实不太完美,好像也会这样:str(SmartPath('tos://xxx')) != 'tos://xxx',不过作为一个 alias 这种功能,先支持到这种程度也没啥问题吧;3 要是实现了,也是挺好的功能 :+1:

LoveEatCandy avatar Sep 02 '24 03:09 LoveEatCandy

修了下上面的 review comments,彭老师眼神真好 👍

bbtfr avatar Oct 31 '24 06:10 bbtfr