Skip to content

Commit 8a1b160

Browse files
committed
Refine option recursive
1 parent 53270ba commit 8a1b160

File tree

6 files changed

+22
-42
lines changed

6 files changed

+22
-42
lines changed

pyarmor/docs/en/user/configuration.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,8 @@ Set option value. For example::
8787
joker:data
8888
:find.py
8989
* - recursive
90-
- Enum
91-
- How to search items in project src
92-
93-
- 0: no search
94-
- 1: only search modules
95-
- 2: search modules and packages
96-
- 3: recursively search all modules and packages
90+
- Bool
91+
- Enable to search modules and packages in project src
9792
* - pypaths
9893
- List
9994
- Extra Python paths to import module on demand::

pyarmor/docs/en/user/man.rst

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,9 @@ In current path create project, update project and show project information
9191

9292
$ pyarmor init -p lib/src@joker
9393

94-
.. option:: -r, --recursive {0,1,2,3}
94+
.. option:: -r, --recursive
9595

96-
How to search items in project src
97-
98-
- 0: no search
99-
- 1: only search modules
100-
- 2: search modules and packages
101-
- 3: recursively search all modules and packages
96+
Enable to search modules and packages in project src
10297

10398
.. option:: -C, --clean
10499

@@ -108,11 +103,11 @@ In current path create project, update project and show project information
108103

109104
Create one project, add all scripts and packages in the current path to this project::
110105

111-
$ pyarmor init -r 2
106+
$ pyarmor init -r
112107

113108
If need exclude some files or paths::
114109

115-
$ pyarmor init -r 2 --exclude venv --exclude "test*.py"
110+
$ pyarmor init -r --exclude venv --exclude "test*.py"
116111

117112
If there has project in current path, this command could show project information::
118113

@@ -136,19 +131,19 @@ All of these examples assume there is still no project in work path
136131

137132
1. Create one project which include all the scripts and packages in current path::
138133

139-
$ pyarmor init -r 3
134+
$ pyarmor init -r
140135

141136
2. Same as above, but not include path `venv` and all scripts which start with `test`::
142137

143-
$ pyarmor init -r 3 --exclude venv --exclude "test*.py"
138+
$ pyarmor init -r --exclude venv --exclude "test*.py"
144139

145140
3. Update project src, :option:`-C` is required to clean old project::
146141

147-
$ pyarmor init -C --src another/src -r 3
142+
$ pyarmor init -C --src another/src -r
148143

149144
4. Create one project which src is not current path::
150145

151-
$ pyarmor init -s eke/src -r 2
146+
$ pyarmor init -s eke/src -r
152147

153148
5. Create one project with only one script::
154149

pyarmor/docs/en/user/tutorials.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Create Complex Project
175175

176176
Let's create one comple project, include one script `jsontool.py` and package `tomjson`, but no `fibo.py` and path `venv`::
177177

178-
$ pyarmor init --clean --src . -r 2 --exclude fibo.py --exclude venv
178+
$ pyarmor init --clean --src . -r --exclude fibo.py --exclude venv
179179

180180
Pyarmor will search all the files and paths in the :option:`--src`, all of them except in the excludes will be added into the project.
181181

pyarmor/docs/zh/user/configuration.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@
9090
:find.py
9191
* - recursive
9292
- 布尔
93-
- 搜索工程路径下的模块和包的模式
94-
95-
- 0 不搜索
96-
- 1 只搜索工程目录下的模块
97-
- 2 只搜索工程目录下的模块和包
98-
- 3 递归搜索工程目录下面的所有的模块和包
93+
- 递归搜索工程路径下的模块和包
9994
* - pypaths
10095
- 列表
10196
- 指定动态导入模块时候的额外路径,支持的格式::

pyarmor/docs/zh/user/man.rst

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pyarmor init
2020

2121
[#]_ pyarmor init -h
2222

23-
[#]_ pyarmor init [-C] [-s PATH] [-x PATTERN] [-r {0,1,2,3}]
23+
[#]_ pyarmor init [-C] [-s PATH] [-x PATTERN] [-r]
2424

2525
[#]_ pyarmor init [-e FILE] [-m FILE] [-p PATH]
2626

@@ -91,14 +91,9 @@ pyarmor init
9191

9292
$ pyarmor init -p lib/src@joker
9393

94-
.. option:: -r, --recursive {0,1,2,3}
94+
.. option:: -r, --recursive
9595

96-
搜索工程目录下面的模块和包的模式
97-
98-
- 0: 不搜索
99-
- 1: 仅搜索工程目录下面的模块
100-
- 2: 搜索工程目录下面的模块和包
101-
- 3: 递归搜索工程目录下面的子目录中模块和包
96+
搜索工程目录下面的模块和包的模式,没有指定该选项,则不会搜索工程目录
10297

10398
.. option:: -C, --clean
10499

@@ -110,7 +105,7 @@ pyarmor init
110105

111106
创建一个新的工程,增加当前路径下面的所有脚本和目录到工程中::
112107

113-
$ pyarmor init -r 2
108+
$ pyarmor init -r
114109

115110
需要把文件或者目录排除在工程之外,使用下面的方式::
116111

@@ -136,21 +131,21 @@ pyarmor init
136131

137132
下面的所有示例中都假定当前目录还没有创建工程
138133

139-
1. 创建一个工程,包含当前目录下面的所有脚本和所有子目录(递归)::
134+
1. 创建一个工程,包含当前目录下面的所有脚本和所有子目录::
140135

141-
$ pyarmor init -r 3
136+
$ pyarmor init -r
142137

143138
2. 和上例类似,但是排除目录 venv 和所有 test 开头的脚本::
144139

145-
$ pyarmor init -r 3 --exclude venv --exclude "test*.py"
140+
$ pyarmor init -r --exclude venv --exclude "test*.py"
146141

147142
3. 修改当前工程的路径,需要使用选项 :option:`-C` 清除原来的工程路径::
148143

149-
$ pyarmor init -C --src another/src -r 3
144+
$ pyarmor init -C --src another/src -r
150145

151146
4. 创建一个工程,包含其他目录下面的所有脚本和目录::
152147

153-
$ pyarmor init -s eke/src -r 2
148+
$ pyarmor init -s eke/src -r
154149

155150
5. 创建包含单独一个脚本的工程::
156151

pyarmor/docs/zh/user/tutorials.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Pyarmor 发布在 PyPI 上面,使用下面的命令直接安装::
185185

186186
下面我们来创建一个工程,包含当前目录下面的脚本 jsontool.py 以及内部包 tomjson,但是不包含 fibo.py 和 venv 目录::
187187

188-
$ pyarmor init --clean --src . -r 2 --exclude fibo.py --exclude venv
188+
$ pyarmor init --clean --src . -r --exclude fibo.py --exclude venv
189189

190190
该命令会自动搜索 :option:`--src` 下面的文件和目录,把发现的模块和包自动增加到工程中
191191

0 commit comments

Comments
 (0)