Skip to content

Commit

Permalink
doc: add folder op doc
Browse files Browse the repository at this point in the history
  • Loading branch information
aboutmydreams committed May 18, 2024
1 parent ca03ded commit ed348cc
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
39 changes: 39 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) # 打印删除的目录的绝对路径
```

## 测试

要运行测试,可以使用以下命令:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="way3",
version="0.0.27",
version="0.0.28",
author="aboutmydreams",
author_email="[email protected]",
description="Simplified file path management for Python developers",
Expand Down

0 comments on commit ed348cc

Please sign in to comment.