From ed348cc9603666024d7c2793ed875385efe9120f Mon Sep 17 00:00:00 2001 From: aboutmydreams Date: Sat, 18 May 2024 17:39:21 +0800 Subject: [PATCH] doc: add folder op doc --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ README_ZH.md | 39 +++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 3 files changed, 81 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29d15f4..483758e 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,47 @@ result = way3.get_current_dir() print(result) # prints the current working directory ``` +### create_directory(directory_name: str, directory_path: Union[str, os.PathLike] = ".") -> str + +Creates a new directory with the given name. + +Example: + +```python +import way3 + +result = way3.create_directory("my_directory") +print(result) # prints the absolute path of the created directory +``` + +### rename_directory(original_name: str, new_name: str) -> str + +Renames a directory with a new name. + +Example: + +```python +import way3 + +result = way3.rename_directory("old_directory", "new_directory") +print(result) # prints the absolute path of the renamed directory +``` + +### delete_directory(directory_name: str, directory_path: Union[str, os.PathLike] = ".") -> str + +Deletes a directory and all its contents. + +Example: + +```python +import way3 + +result = way3.delete_directory("my_directory") +print(result) # prints the absolute path of the deleted directory +``` + +Let me know if you need any further modifications! + ## Testing To run the tests, you can use the following command: diff --git a/README_ZH.md b/README_ZH.md index 83e5b87..f23e1d5 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -78,6 +78,45 @@ result = way3.get_current_dir() print(result) # 打印当前工作目录 ``` +### create_directory(目录名: str, 目录路径: Union[str, os.PathLike] = ".") -> str + +创建一个具有给定名称的新目录。 + +示例: + +```python +import way3 + +result = way3.create_directory("我的目录") +print(result) # 打印创建的目录的绝对路径 +``` + +### rename_directory(原始名称: str, 新名称: str) -> str + +重命名一个目录。 + +示例: + +```python +import way3 + +result = way3.rename_directory("旧目录", "新目录") +print(result) # 打印重命名后的目录的绝对路径 +``` + +### delete_directory(目录名: str, 目录路径: Union[str, os.PathLike] = ".") -> str + +删除一个目录及其所有内容。 + +示例: + +```python +import way3 + +result = way3.delete_directory("我的目录") +print(result) # 打印删除的目录的绝对路径 +``` + ## 测试 要运行测试,可以使用以下命令: diff --git a/setup.py b/setup.py index 3521c0b..19c8328 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="way3", - version="0.0.27", + version="0.0.28", author="aboutmydreams", author_email="aboutmydreams@163.com", description="Simplified file path management for Python developers",