1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: rename module to package, when it comes to all VPM commands like v install etc (#16180)

This commit is contained in:
kahsa 2022-10-25 00:00:55 +09:00 committed by GitHub
parent d3fcb6bca0
commit 779cc33825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 54 deletions

View File

@ -1,14 +1,14 @@
Usage: Usage:
v install [MODULE...] v install [PACKAGE...]
Installs each MODULE. Installs each PACKAGE.
If no MODULEs, the modules listed in the `v.mod` file are installed instead. If no PACKAGEs, the packages listed in the `v.mod` file are installed instead.
Options: Options:
--vpm - [Default] Install from vpm --vpm - [Default] Install from vpm
--git - Install from git repository url --git - Install from git repository url
--hg - Install from mercurial repository url --hg - Install from mercurial repository url
--once - Only install the module if it was not previously installed --once - Only install the package if it was not previously installed
-help - Show usage info. -help - Show usage info.
-v - Print more details about the performed operation. -v - Print more details about the performed operation.
-server-url - When doing network operations, use this vpm server. Can be given multiple times. -server-url - When doing network operations, use this vpm server. Can be given multiple times.

View File

@ -1,3 +1,3 @@
Usage: v list Usage: v list
List all installed modules. List all installed packages.

View File

@ -1,7 +1,7 @@
Usage: Usage:
v remove [MODULE...] v remove [PACKAGE...]
Removes all listed MODULEs. Removes all listed PACKAGEs.
If no MODULE is provided, removes ALL installed modules. If no PACKAGE is provided, removes ALL installed packages.
Options: Options:
-help - Show usage info. -help - Show usage info.

View File

@ -1,8 +1,8 @@
Usage: Usage:
v update [MODULE]... v update [PACKAGE]...
Updates each MODULE. Updates each PACKAGE.
With no MODULE, ALL installed modules are updated to their latest versions. With no PACKAGE, ALL installed packages are updated to their latest versions.
Options: Options:
-help - Show usage info. -help - Show usage info.

View File

@ -1,8 +1,8 @@
Usage: Usage:
a) v install [MODULE...] a) v install [PACKAGE...]
b) v update [MODULE...] b) v update [PACKAGE...]
c) v remove [MODULE...] c) v remove [PACKAGE...]
d) v search KEYWORD[...] d) v search KEYWORD[...]
e) v show [MODULE...] e) v show [PACKAGE...]
You can also pass -h or --help after each vpm command from the above, to see more details about it. You can also pass -h or --help after each vpm command from the above, to see more details about it.

View File

@ -133,7 +133,7 @@ To do so, run the command `v up`.
* [v shader](#v-shader) * [v shader](#v-shader)
* [Profiling](#profiling) * [Profiling](#profiling)
* [Package Management](#package-management) * [Package Management](#package-management)
* [module options](#module-options) * [Package options](#package-options)
* [Publish package](#publish-package) * [Publish package](#publish-package)
* [Advanced Topics](#advanced-topics) * [Advanced Topics](#advanced-topics)
* [Memory-unsafe code](#memory-unsafe-code) * [Memory-unsafe code](#memory-unsafe-code)
@ -4800,32 +4800,34 @@ fn main() {
## Package management ## Package management
Module consists of single folder. Package consists of multiple modules.
```powershell ```powershell
v [module option] [param] v [package option] [param]
``` ```
### module options ### Package options
``` ```
install Install a module from VPM. install Install a package from VPM.
remove Remove a module that was installed from VPM. remove Remove a package that was installed from VPM.
search Search for a module from VPM. search Search for a package from VPM.
update Update an installed module from VPM. update Update an installed package from VPM.
upgrade Upgrade all the outdated modules. upgrade Upgrade all the outdated packages.
list List all installed modules. list List all installed packages.
outdated Show installed modules that need updates. outdated Show installed packages that need updates.
``` ```
You can install modules already created by someone else with [VPM](https://vpm.vlang.io/): You can install packages already created by someone else with [VPM](https://vpm.vlang.io/):
```powershell ```powershell
v install [module] v install [package]
``` ```
**Example:** **Example:**
```powershell ```powershell
v install ui v install ui
``` ```
Modules can be installed directly from git or mercurial repositories. Packages can be installed directly from git or mercurial repositories.
```powershell ```powershell
v install [--once] [--git|--hg] [url] v install [--once] [--git|--hg] [url]
``` ```
@ -4837,35 +4839,35 @@ v install --git https://github.com/vlang/markdown
Sometimes you may want to install the dependencies **ONLY** if those are not installed: Sometimes you may want to install the dependencies **ONLY** if those are not installed:
``` ```
v install --once [module] v install --once [package]
``` ```
Removing a module with v: Removing a package with v:
```powershell ```powershell
v remove [module] v remove [package]
``` ```
**Example:** **Example:**
```powershell ```powershell
v remove ui v remove ui
``` ```
Updating an installed module from [VPM](https://vpm.vlang.io/): Updating an installed package from [VPM](https://vpm.vlang.io/):
```powershell ```powershell
v update [module] v update [package]
``` ```
**Example:** **Example:**
```powershell ```powershell
v update ui v update ui
``` ```
Or you can update all your modules: Or you can update all your packages:
```powershell ```powershell
v update v update
``` ```
To see all the modules you have installed, you can use: To see all the packages you have installed, you can use:
```powershell ```powershell
v list v list
@ -4873,29 +4875,29 @@ v list
**Example:** **Example:**
```powershell ```powershell
> v list > v list
Installed modules: Installed packages:
markdown markdown
ui ui
``` ```
To see all the modules that need updates: To see all the packages that need updates:
```powershell ```powershell
v outdated v outdated
``` ```
**Example:** **Example:**
```powershell ```powershell
> v outdated > v outdated
Modules are up to date. Package are up to date.
``` ```
### Publish package ### Publish package
1. Put a `v.mod` file inside the toplevel folder of your module (if you 1. Put a `v.mod` file inside the toplevel folder of your package (if you
created your module with the command `v new mymodule` or `v init` you already have a v.mod file). created your package with the command `v new mypackage` or `v init` you already have a v.mod file).
```sh ```sh
v new mymodule v new mypackage
Input your project description: My nice module. Input your project description: My nice package.
Input your project version: (0.0.0) 0.0.1 Input your project version: (0.0.0) 0.0.1
Input your project license: (MIT) Input your project license: (MIT)
Initialising ... Initialising ...
@ -4905,8 +4907,8 @@ Modules are up to date.
Example `v.mod`: Example `v.mod`:
```v ignore ```v ignore
Module { Module {
name: 'mymodule' name: 'mypackage'
description: 'My nice module.' description: 'My nice package.'
version: '0.0.1' version: '0.0.1'
license: 'MIT' license: 'MIT'
dependencies: [] dependencies: []
@ -4916,13 +4918,13 @@ Modules are up to date.
Minimal file structure: Minimal file structure:
``` ```
v.mod v.mod
mymodule.v mypackage.v
``` ```
The name of your module should be used with the `module` directive The name of your package should be used with the `module` directive
at the top of all files in your module. For `mymodule.v`: at the top of all files in your package. For `mypackage.v`:
```v ```v
module mymodule module mypackage
pub fn hello_world() { pub fn hello_world() {
println('Hello World!') println('Hello World!')
@ -4939,16 +4941,16 @@ Modules are up to date.
3. Create a public repository on github.com. 3. Create a public repository on github.com.
4. Connect your local repository to the remote repository and push the changes. 4. Connect your local repository to the remote repository and push the changes.
5. Add your module to the public V module registry VPM: 5. Add your package to the public V package registry VPM:
https://vpm.vlang.io/new https://vpm.vlang.io/new
You will have to login with your Github account to register the module. You will have to login with your Github account to register the package.
**Warning:** _Currently it is not possible to edit your entry after submitting. **Warning:** _Currently it is not possible to edit your entry after submitting.
Check your module name and github url twice as this cannot be changed by you later._ Check your package name and github url twice as this cannot be changed by you later._
6. The final module name is a combination of your github account and 6. The final package name is a combination of your github account and
the module name you provided e.g. `mygithubname.mymodule`. the package name you provided e.g. `mygithubname.mypackage`.
**Optional:** tag your V module with `vlang` and `vlang-module` on github.com **Optional:** tag your V package with `vlang` and `vlang-package` on github.com
to allow for a better search experience. to allow for a better search experience.
# Advanced Topics # Advanced Topics