Skip to content

Commit ed348cc

Browse files
committed
doc: add folder op doc
1 parent ca03ded commit ed348cc

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-1
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,47 @@ result = way3.get_current_dir()
7878
print(result) # prints the current working directory
7979
```
8080

81+
### create_directory(directory_name: str, directory_path: Union[str, os.PathLike] = ".") -> str
82+
83+
Creates a new directory with the given name.
84+
85+
Example:
86+
87+
```python
88+
import way3
89+
90+
result = way3.create_directory("my_directory")
91+
print(result) # prints the absolute path of the created directory
92+
```
93+
94+
### rename_directory(original_name: str, new_name: str) -> str
95+
96+
Renames a directory with a new name.
97+
98+
Example:
99+
100+
```python
101+
import way3
102+
103+
result = way3.rename_directory("old_directory", "new_directory")
104+
print(result) # prints the absolute path of the renamed directory
105+
```
106+
107+
### delete_directory(directory_name: str, directory_path: Union[str, os.PathLike] = ".") -> str
108+
109+
Deletes a directory and all its contents.
110+
111+
Example:
112+
113+
```python
114+
import way3
115+
116+
result = way3.delete_directory("my_directory")
117+
print(result) # prints the absolute path of the deleted directory
118+
```
119+
120+
Let me know if you need any further modifications!
121+
81122
## Testing
82123

83124
To run the tests, you can use the following command:

README_ZH.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,45 @@ result = way3.get_current_dir()
7878
print(result) # 打印当前工作目录
7979
```
8080

81+
### create_directory(目录名: str, 目录路径: Union[str, os.PathLike] = ".") -> str
82+
83+
创建一个具有给定名称的新目录。
84+
85+
示例:
86+
87+
```python
88+
import way3
89+
90+
result = way3.create_directory("我的目录")
91+
print(result) # 打印创建的目录的绝对路径
92+
```
93+
94+
### rename_directory(原始名称: str, 新名称: str) -> str
95+
96+
重命名一个目录。
97+
98+
示例:
99+
100+
```python
101+
import way3
102+
103+
result = way3.rename_directory("旧目录", "新目录")
104+
print(result) # 打印重命名后的目录的绝对路径
105+
```
106+
107+
### delete_directory(目录名: str, 目录路径: Union[str, os.PathLike] = ".") -> str
108+
109+
删除一个目录及其所有内容。
110+
111+
示例:
112+
113+
```python
114+
import way3
115+
116+
result = way3.delete_directory("我的目录")
117+
print(result) # 打印删除的目录的绝对路径
118+
```
119+
81120
## 测试
82121

83122
要运行测试,可以使用以下命令:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="way3",
8-
version="0.0.27",
8+
version="0.0.28",
99
author="aboutmydreams",
1010
author_email="aboutmydreams@163.com",
1111
description="Simplified file path management for Python developers",

0 commit comments

Comments
 (0)