parent
29c40cf1f1
commit
aad47de6a1
29 changed files with 669 additions and 329 deletions
@ -1,7 +1,13 @@ |
|||||||
# Python Script Tease |
# Python Script Tease |
||||||
|
|
||||||
![](https://img.shields.io/badge/status-active-green.svg) |
![](https://img.shields.io/badge/status-active-green.svg) |
||||||
![](https://img.shields.io/badge/stage-development-blue.svg) |
![](https://img.shields.io/badge/stage-stable-green.svg) |
||||||
![](https://img.shields.io/badge/coverage-100%25-green.svg) |
![](https://img.shields.io/badge/coverage-100%25-green.svg) |
||||||
|
|
||||||
A collection of classes and commands for automated command line scripting using Python. |
A collection of classes and commands for automated command line scripting using Python. |
||||||
|
|
||||||
|
## Install |
||||||
|
|
||||||
|
```bash |
||||||
|
pip install python-scripttease; |
||||||
|
``` |
||||||
|
|
@ -1,70 +0,0 @@ |
|||||||
# PostgreSQL |
|
||||||
|
|
||||||
Summary: Work with Postgres databases. |
|
||||||
|
|
||||||
## Common Options |
|
||||||
|
|
||||||
- `admin_pass`: The password off the admin-authorized user. |
|
||||||
- `admin_user`: The user name of the admin-authorized user. Default: `postgres` |
|
||||||
- `host`: The host name. Default: `localhost` |
|
||||||
- `port`: The TCP port. Default: `5432` |
|
||||||
|
|
||||||
## Available Commands |
|
||||||
|
|
||||||
### pgsql.create |
|
||||||
|
|
||||||
Create a database. Argument is the database name. |
|
||||||
|
|
||||||
- `owner`: The user name that owns the database. |
|
||||||
|
|
||||||
```ini |
|
||||||
[create the database] |
|
||||||
pgsql.create: database_name |
|
||||||
``` |
|
||||||
|
|
||||||
### pgsql.drop |
|
||||||
|
|
||||||
Drop a database. Argument is the database name. |
|
||||||
|
|
||||||
### pgsql.dump |
|
||||||
|
|
||||||
Dump the database schema. Argument is the database name. |
|
||||||
|
|
||||||
- `path`: The path to the dump file. Default: `dump.sql` |
|
||||||
|
|
||||||
### pgsql.exec |
|
||||||
|
|
||||||
Execute an SQL statement. Argument is the SQL statement. |
|
||||||
|
|
||||||
- `database`: The name of the database where the statement will be executed. Default: `default` |
|
||||||
|
|
||||||
### pgsql.exists |
|
||||||
|
|
||||||
Determine if a database exists. Argument is the database name. |
|
||||||
|
|
||||||
### pgsql.user |
|
||||||
|
|
||||||
Create a user. Argument is the user name. |
|
||||||
|
|
||||||
- `password`: The user's password. |
|
||||||
|
|
||||||
```ini |
|
||||||
[create a database user] |
|
||||||
pgsql.user: username |
|
||||||
``` |
|
||||||
|
|
||||||
Remove a user. |
|
||||||
|
|
||||||
```ini |
|
||||||
[remove a database user] |
|
||||||
pgsql.user: username |
|
||||||
op: remove |
|
||||||
``` |
|
||||||
|
|
||||||
Determine if a user exists. |
|
||||||
|
|
||||||
```ini |
|
||||||
[determine if database user exists] |
|
||||||
pgsql.user: username |
|
||||||
op: exists |
|
||||||
``` |
|
@ -1,148 +0,0 @@ |
|||||||
# POSIX |
|
||||||
|
|
||||||
Summary: Work with common POSIX-compliant commands.. |
|
||||||
|
|
||||||
## Available Commands |
|
||||||
|
|
||||||
### append |
|
||||||
|
|
||||||
Append content to a file. Argument is the file name. |
|
||||||
|
|
||||||
- `content`: The content to be appended. |
|
||||||
|
|
||||||
### archive |
|
||||||
|
|
||||||
Create an archive (tarball). Argument is the target file or directory. |
|
||||||
|
|
||||||
- `absolute`: Don't strip leading slashes from file names. |
|
||||||
- `view`: View the progress. |
|
||||||
- `exclude`: Exclude file name patterns. |
|
||||||
- `strip`: Strip component paths to the given depth (integer). |
|
||||||
- `to`: The path to where the archive will be created. |
|
||||||
|
|
||||||
### copy |
|
||||||
|
|
||||||
Copy a file or directory. First argument is the target file/directory. Second argument is the destination. |
|
||||||
|
|
||||||
- `overwrite`: Overwrite an existing target. |
|
||||||
- `recursive`: Copy directories recursively. |
|
||||||
|
|
||||||
### dir |
|
||||||
|
|
||||||
Create a directory. Argument is the path. |
|
||||||
|
|
||||||
- `group`: Set the group to the given group name. |
|
||||||
- `mode`: Set the mode on the path. |
|
||||||
- `owner`: Set the owner to the given owner name. |
|
||||||
- `recursive`: Create the full path even if intermediate directories do not exist. |
|
||||||
|
|
||||||
### extract |
|
||||||
|
|
||||||
Extract an archive (tarball). Argument is the path to the archive file. |
|
||||||
|
|
||||||
- `absolute`: Strip leading slashes from file names. |
|
||||||
- `view`: View the progress. |
|
||||||
- `exclude`: Exclude file name patterns. |
|
||||||
- `strip`: Strip component paths to the given depth (integer). |
|
||||||
- `to`: The path to where the archive will be extracted. Defaults to the current working directory. |
|
||||||
|
|
||||||
### file |
|
||||||
|
|
||||||
Create a file. Argument is the path. |
|
||||||
|
|
||||||
- `content`: The content of the file. Otherwise, an empty file is created. |
|
||||||
- `group`: Set the group to the given group name. |
|
||||||
- `mode`: Set the mode on the path. |
|
||||||
- `owner`: Set the owner to the given owner name. |
|
||||||
|
|
||||||
### link |
|
||||||
|
|
||||||
Create a symlink. First argument is the target. Second argument is the destination. |
|
||||||
|
|
||||||
- `force`: Force creation of the link. |
|
||||||
|
|
||||||
### move |
|
||||||
|
|
||||||
Move a file or directory. First argument is the target. Second argument is the desitnation. |
|
||||||
|
|
||||||
### perms |
|
||||||
|
|
||||||
Set permissions on a file or directory. Argument is the path. |
|
||||||
|
|
||||||
- `group`: Set the group to the given group name. |
|
||||||
- `mode`: Set the mode on the path. |
|
||||||
- `owner`: Set the owner to the given owner name. |
|
||||||
- `recursive`: Apply permission recursively (directories only). |
|
||||||
|
|
||||||
### push |
|
||||||
|
|
||||||
Push (rsync) a path to a remote server. First argument is the local path. Second argument is the remote path. |
|
||||||
|
|
||||||
- `delete`: Delete existing files/directories. |
|
||||||
- `host`: The host name. Required. |
|
||||||
- `key_file`: Use the given SSL (private) key. Required. |
|
||||||
- `links`: Copy symlinks. |
|
||||||
- `exclude`: Exclude patterns from the given (local) file. |
|
||||||
- `port`: The TCP port on the host. Default: `22` |
|
||||||
- `recursive`: Operate recursively on directories. |
|
||||||
- `user`: The user name. Required. |
|
||||||
|
|
||||||
### remove |
|
||||||
|
|
||||||
Remove a file or directory. Argument is the path. |
|
||||||
|
|
||||||
- `force`: Force the removal. |
|
||||||
- `recursive`: Remove (directories) rescurisvely. |
|
||||||
|
|
||||||
### rename |
|
||||||
|
|
||||||
Rename a file or directory. First argument is the target. Second argument is the destination. |
|
||||||
|
|
||||||
### replace |
|
||||||
|
|
||||||
Replace something in a file. First argument is the path. |
|
||||||
|
|
||||||
- `backup`: Create a backup. |
|
||||||
- `delimiiter`: The sed delimiter. Default: `/` |
|
||||||
- `find`: The text to be found. Required. |
|
||||||
- `sub`: The text to be replaced. Required. |
|
||||||
|
|
||||||
### scopy |
|
||||||
|
|
||||||
Copy a file to a remote server. First argument is the local file name. Second argument is the remote destination. |
|
||||||
|
|
||||||
- `key_file`: The private key file to use for the connection. |
|
||||||
- `host`: The host name. Required. |
|
||||||
- `port`: The TCP port. Default: `22` |
|
||||||
- `user`: The user name. Required. |
|
||||||
|
|
||||||
### ssl |
|
||||||
|
|
||||||
Use Let's Encrypt (certbot) to acquire an SSL certificate. Argument is the domain name. |
|
||||||
|
|
||||||
- `email`: The email address for "agree tos". Default: `webmaster@domain_name` |
|
||||||
- `webroot`: The webroot to use. Default: `/var/www/maint/www` |
|
||||||
|
|
||||||
### sync |
|
||||||
|
|
||||||
Sync (rsync) local files and directories. First argument is the target. Second argument is the destination. |
|
||||||
|
|
||||||
- `delete`: Delete existing files/directories. |
|
||||||
- `links`: Copy symlinks. |
|
||||||
- `exclude`: Exclude patterns from the given (local) file. |
|
||||||
- `recursive`: Operate recursively on directories. |
|
||||||
|
|
||||||
### touch |
|
||||||
|
|
||||||
Touch a file, whether it exists or not. Argument is the path. |
|
||||||
|
|
||||||
### wait |
|
||||||
|
|
||||||
Wait for n number of seconds before continuing. Argument is the number of seconds. |
|
||||||
|
|
||||||
### write |
|
||||||
|
|
||||||
Write to a file. Argument is the path. |
|
||||||
|
|
||||||
- `content`: The content to write to the file. Replaces existing content. |
|
||||||
|
|
@ -1,20 +0,0 @@ |
|||||||
# Python |
|
||||||
|
|
||||||
Summary: Work with Python. |
|
||||||
|
|
||||||
## Available Commands |
|
||||||
|
|
||||||
### pip |
|
||||||
|
|
||||||
Use the pip command. Argument is the package name. |
|
||||||
|
|
||||||
- `op`: The operation; `install` (the default), `remove`, or `updgrade`. |
|
||||||
- `venv`: The name of the virtual environment to use. |
|
||||||
|
|
||||||
### pip3 |
|
||||||
|
|
||||||
Use Python3 pip. See pip above. |
|
||||||
|
|
||||||
### virtualenv |
|
||||||
|
|
||||||
Create a python virtual environment. Argument is the environment name. |
|
@ -1,6 +1,6 @@ |
|||||||
# Command File |
# Steps File |
||||||
|
|
||||||
A command file contains the metadata about the commands to be generated. INI and YAML formats are supported. |
A steps file contains the metadata about the commands to be generated. INI and YAML formats are supported. |
||||||
|
|
||||||
In an INI file, each section is a command. With YAML, each top-level list item is a command. |
In an INI file, each section is a command. With YAML, each top-level list item is a command. |
||||||
|
|
@ -0,0 +1,119 @@ |
|||||||
|
# PostgreSQL |
||||||
|
|
||||||
|
Summary: Work with Postgres databases. |
||||||
|
|
||||||
|
## Common Options |
||||||
|
|
||||||
|
- `host` (str): The host name. Default: `localhost` |
||||||
|
- `password` (str): The password of the user executing the command. |
||||||
|
- `port` (int): The TCP port. Default: `5432` |
||||||
|
- `user` (str): The username of the user executing the command. Default: `postgres` |
||||||
|
|
||||||
|
## Automatic Conversion of Postgres Command Switches |
||||||
|
|
||||||
|
Options provided in the steps file are automatically converted to command line switches. For example: |
||||||
|
|
||||||
|
```ini |
||||||
|
[create a soft backup of the database schema] |
||||||
|
pgsql.dump: example_app |
||||||
|
schema_only: yes |
||||||
|
path: /tmp/example_app.sql |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
`schema_only` becomes "--schema-only". |
||||||
|
|
||||||
|
## Available Commands |
||||||
|
|
||||||
|
### pgsql.create |
||||||
|
|
||||||
|
Create a database. Argument is the database name. |
||||||
|
|
||||||
|
- `owner` (str): The username that owns the database. |
||||||
|
|
||||||
|
```ini |
||||||
|
[create the database] |
||||||
|
pgsql.create: database_name |
||||||
|
``` |
||||||
|
|
||||||
|
### pgsql.drop |
||||||
|
|
||||||
|
Drop a database. Argument is the database name. |
||||||
|
|
||||||
|
```ini |
||||||
|
[drop the testing database] |
||||||
|
pgsql.drop: testing_example_app |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### pgsql.dump |
||||||
|
|
||||||
|
Dump the database schema. Argument is the database name. |
||||||
|
|
||||||
|
- `path` (str): The path to the dump file. Default: `database_name.sql` |
||||||
|
|
||||||
|
```ini |
||||||
|
[create a soft backup of the database] |
||||||
|
pgsql.dump: example_app |
||||||
|
column_inserts: yes |
||||||
|
path: /tmp/example_app.sql |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### pgsql.exists |
||||||
|
|
||||||
|
Determine if a database exists. Argument is the database name. |
||||||
|
|
||||||
|
```ini |
||||||
|
[determine if the database exists] |
||||||
|
pgsql.exists: example_app |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### pgsql.grant |
||||||
|
|
||||||
|
Grant privileges to a user. Argument is the username. Database option is required. |
||||||
|
|
||||||
|
- `database` (str): The name of the database where the target object exists. |
||||||
|
- `privileges` (str): The privileges to be granted. Default `ALL` (see [Postgres docs](https://www.postgresql.org/docs/current/sql-grant.html)) |
||||||
|
- `schema` (str): The schema name to which the privileges apply. |
||||||
|
- `table` (str): The table name to which privileges apply. |
||||||
|
|
||||||
|
!!! note |
||||||
|
A schema name or table name is required. |
||||||
|
|
||||||
|
```ini |
||||||
|
[grant select access to bob] |
||||||
|
pgsql.grant: bob |
||||||
|
database: example_app |
||||||
|
privileges: select |
||||||
|
schema: public |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### pgsql.user |
||||||
|
|
||||||
|
Create a user. Argument is the user name. |
||||||
|
|
||||||
|
- `password` (str): The user's password. |
||||||
|
|
||||||
|
```ini |
||||||
|
[create a database user] |
||||||
|
pgsql.user: username |
||||||
|
``` |
||||||
|
|
||||||
|
Remove a user. |
||||||
|
|
||||||
|
```ini |
||||||
|
[remove a database user] |
||||||
|
pgsql.user: username |
||||||
|
op: remove |
||||||
|
``` |
||||||
|
|
||||||
|
Determine if a user exists. |
||||||
|
|
||||||
|
```ini |
||||||
|
[determine if database user exists] |
||||||
|
pgsql.user: username |
||||||
|
op: exists |
||||||
|
``` |
@ -0,0 +1,264 @@ |
|||||||
|
# POSIX |
||||||
|
|
||||||
|
Summary: Work with common POSIX-compliant commands.. |
||||||
|
|
||||||
|
## Available Commands |
||||||
|
|
||||||
|
### append |
||||||
|
|
||||||
|
Append content to a file. Argument is the file name. |
||||||
|
|
||||||
|
- `content` (str): The content to be appended. |
||||||
|
|
||||||
|
```ini |
||||||
|
[add to the log file] |
||||||
|
append: /path/to/file.log |
||||||
|
content: This is a test. |
||||||
|
``` |
||||||
|
|
||||||
|
### archive |
||||||
|
|
||||||
|
Create an archive (tarball). Argument is the target file or directory. |
||||||
|
|
||||||
|
- `absolute` (bool): Don't strip leading slashes from file names. Default `False` |
||||||
|
- `exclude` (str): Exclude file name patterns. |
||||||
|
- `file_name` (str): The name of the archive file. Default `archive.tgz` |
||||||
|
- `strip` (int): Strip component paths to the given depth. |
||||||
|
- `to_path` (str): The path to where the archive will be created. Default `.` |
||||||
|
- `view` (bool): View the progress. Default `False` |
||||||
|
|
||||||
|
```ini |
||||||
|
[create an archive of the site] |
||||||
|
archive: /path/to/file_or_directory |
||||||
|
file_name: testing.tgz |
||||||
|
to: /tmp |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### certbot |
||||||
|
|
||||||
|
Alias: ssl |
||||||
|
|
||||||
|
Use Let's Encrypt (certbot) to acquire an SSL certificate. Argument is the domain name. |
||||||
|
|
||||||
|
- `email`: The email address for "agree tos". Default: `webmaster@domain_name` |
||||||
|
- `webroot`: The webroot to use. Default: `/var/www/maint/www` |
||||||
|
|
||||||
|
```ini |
||||||
|
[get an SSL cert] |
||||||
|
ssl: example.app |
||||||
|
email: webmaster@example.app |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### copy |
||||||
|
|
||||||
|
Copy a file or directory. First argument is the target file/directory. Second argument is the destination. |
||||||
|
|
||||||
|
- `overwrite` (bool): Overwrite an existing target. |
||||||
|
- `recursive` (bool): Copy directories recursively. |
||||||
|
|
||||||
|
```ini |
||||||
|
[copy a directory] |
||||||
|
copy: /path/to/directory /path/to/new_directory |
||||||
|
overwrite: yes |
||||||
|
recursive: yes |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### dir |
||||||
|
|
||||||
|
Create a directory. Argument is the path. |
||||||
|
|
||||||
|
- `group` (str): Set the group to the given group name. |
||||||
|
- `mode` (str): Set the mode on the path. |
||||||
|
- `owner` (str): Set the owner to the given owner name. |
||||||
|
- `recursive` (str): Create the full path even if intermediate directories do not exist. |
||||||
|
|
||||||
|
```ini |
||||||
|
[create a directory] |
||||||
|
dir: /path/to/directory |
||||||
|
group: www-data |
||||||
|
mode: 755 |
||||||
|
owner: deploy |
||||||
|
recursive: yes |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### extract |
||||||
|
|
||||||
|
Extract an archive (tarball). Argument is the path to the archive file. |
||||||
|
|
||||||
|
- `absolute` (bool): Don't strip leading slashes from file names. Default `False` |
||||||
|
- `exclude` (str): Exclude file name patterns. |
||||||
|
- `strip` (int): Strip component paths to the given depth. |
||||||
|
- `to_path` (str): The path to where the archive will be created. Default `./` |
||||||
|
- `view` (bool): View the progress. Default `False` |
||||||
|
|
||||||
|
```ini |
||||||
|
[extract an archive] |
||||||
|
extract: /path/to/archive.tgz |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### link |
||||||
|
|
||||||
|
Create a symlink. First argument is the source. |
||||||
|
|
||||||
|
- `force` (bool): Force creation of the link. |
||||||
|
- `target` (str): The location of the link. Defaults to the current directory and the base name of the source. |
||||||
|
|
||||||
|
```ini |
||||||
|
[create a symlink] |
||||||
|
link: /path/to/project/releases/1.0 |
||||||
|
cd: /path/to/project |
||||||
|
force: yes |
||||||
|
target: current |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### move |
||||||
|
|
||||||
|
Move a file or directory. First argument is the target. Second argument is the desitnation. |
||||||
|
|
||||||
|
```ini |
||||||
|
[move a file] |
||||||
|
move: /path/to/file.txt /new/path/to/file.txt |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### perms |
||||||
|
|
||||||
|
Set permissions on a file or directory. Argument is the path. |
||||||
|
|
||||||
|
- `group` (str): Set the group to the given group name. |
||||||
|
- `mode` (str): Set the mode on the path. |
||||||
|
- `owner` (str): Set the owner to the given owner name. |
||||||
|
- `recursive` (bool): Apply permission recursively (directories only). |
||||||
|
|
||||||
|
```ini |
||||||
|
[set permissions on the shared directory] |
||||||
|
perms: /path/to/project/shared |
||||||
|
group: www-data |
||||||
|
mode: 775 |
||||||
|
owner: deploy |
||||||
|
recursive: yes |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### push |
||||||
|
|
||||||
|
Alias: rsync |
||||||
|
|
||||||
|
Push (rsync) a path to a remote server. First argument is the local path. Second argument is the remote path. |
||||||
|
|
||||||
|
- `delete` (bool): Delete existing files/directories. Default `False` |
||||||
|
- `host` (str): The host name. Required. |
||||||
|
- `key_file` (str): Use the given SSL (private) key. |
||||||
|
- `links` (bool): Copy symlinks. Default `True |
||||||
|
- `exclude` (str): Exclude patterns from the given (local) file. |
||||||
|
- `port` (int): The TCP port on the host. Default: `22` |
||||||
|
- `recursive` (bool): Operate recursively on directories. |
||||||
|
- `user` (str): The username. |
||||||
|
|
||||||
|
```ini |
||||||
|
[push the project to the server] |
||||||
|
push: /path/to/project /path/on/server |
||||||
|
key_file: ~/.ssh/example_app |
||||||
|
host: example.app |
||||||
|
user: deploy |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### remove |
||||||
|
|
||||||
|
Remove a file or directory. Argument is the path. |
||||||
|
|
||||||
|
- `force` (bool): Force the removal. Default `False` |
||||||
|
- `recursive` (bool): Remove all directories in the path. Default `False` |
||||||
|
|
||||||
|
```ini |
||||||
|
[remove a directory] |
||||||
|
remove: /path/to/directory |
||||||
|
force: yes |
||||||
|
recusrive: yes |
||||||
|
``` |
||||||
|
|
||||||
|
### replace |
||||||
|
|
||||||
|
Replace something in a file. First argument is the path. |
||||||
|
|
||||||
|
- `backup`: Backup file extension. Default `.b` |
||||||
|
- `delimiiter`: The sed delimiter. Default: `/` |
||||||
|
- `find`: The text to be found. Required. |
||||||
|
- `sub`: The text to be replaced. Required. |
||||||
|
|
||||||
|
```ini |
||||||
|
[replace text in a file] |
||||||
|
replace: /path/to/file.txt |
||||||
|
find: testing |
||||||
|
sub: 123 |
||||||
|
``` |
||||||
|
|
||||||
|
### scopy |
||||||
|
|
||||||
|
Copy a file to a remote server. First argument is the local file name. Second argument is the remote destination. |
||||||
|
|
||||||
|
- `key_file` (str): The private key file to use for the connection. |
||||||
|
- `host` (str): The host name. Required. |
||||||
|
- `port` (int): The TCP port. Default: `22` |
||||||
|
- `user` (str): The username. Required. |
||||||
|
|
||||||
|
```ini |
||||||
|
[copy a file to the server] |
||||||
|
scopy: /path/to/local.txt path/to/remove.txt |
||||||
|
host: example.app |
||||||
|
user: deploy |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### sync |
||||||
|
|
||||||
|
Sync (rsync) local files and directories. First argument is the target. Second argument is the destination. |
||||||
|
|
||||||
|
- `delete` (bool): Delete existing files/directories. |
||||||
|
- `links` (bool): Copy symlinks. |
||||||
|
- `exclude` (str): Exclude patterns from the given (local) file. |
||||||
|
- `recursive` (bool): Operate recursively on directories. |
||||||
|
|
||||||
|
```ini |
||||||
|
[syncrhonize files on the local machine] |
||||||
|
sync: /path/to/project /path/to/sync/directory |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### touch |
||||||
|
|
||||||
|
Touch a file, whether it exists or not. Argument is the path. |
||||||
|
|
||||||
|
```ini |
||||||
|
[touch a file] |
||||||
|
touch: /path/to/file.txt |
||||||
|
``` |
||||||
|
|
||||||
|
### wait |
||||||
|
|
||||||
|
Wait for n number of seconds before continuing. Argument is the number of seconds. |
||||||
|
|
||||||
|
```ini |
||||||
|
[wait just a minute] |
||||||
|
wait: 60 |
||||||
|
``` |
||||||
|
|
||||||
|
### write |
||||||
|
|
||||||
|
Write to a file. Argument is the path. |
||||||
|
|
||||||
|
- `content` (str): The content to write to the file. Replaces existing content. |
||||||
|
|
||||||
|
```ini |
||||||
|
[replace an existing file] |
||||||
|
write: /path/to/file.txt |
||||||
|
content: This whole file has been replaced. |
||||||
|
|
||||||
|
``` |
@ -0,0 +1,49 @@ |
|||||||
|
# Python |
||||||
|
|
||||||
|
Summary: Work with Python. |
||||||
|
|
||||||
|
## Available Commands |
||||||
|
|
||||||
|
### pip |
||||||
|
|
||||||
|
Use the pip command. Argument is the package name. |
||||||
|
|
||||||
|
- `op` (str): The operation; `install` (the default) or `remove`. |
||||||
|
- `upgrade` (bool): Upgrade the package. |
||||||
|
- `venv` (str): The name of the virtual environment to use. |
||||||
|
- `version` (int): The pip version to use. Default `3` |
||||||
|
|
||||||
|
```ini |
||||||
|
[install django] |
||||||
|
pip: django |
||||||
|
cd: /path/to/project |
||||||
|
venv: python |
||||||
|
``` |
||||||
|
|
||||||
|
### pip_file |
||||||
|
|
||||||
|
Alias: pipf |
||||||
|
|
||||||
|
Install packages from a pip file. |
||||||
|
|
||||||
|
- `venv` (str): The name of the virtual environment to use. |
||||||
|
- `version` (int): The pip version to use. Default `3` |
||||||
|
|
||||||
|
```ini |
||||||
|
[install dependencies] |
||||||
|
pip_file: deploy/packages/testing.pip |
||||||
|
cd: path/to/project |
||||||
|
venv: python |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
### virtualenv |
||||||
|
|
||||||
|
Create a python virtual environment. Argument is the environment name. |
||||||
|
|
||||||
|
```ini |
||||||
|
[create the virtual environment] |
||||||
|
virtualenv: python |
||||||
|
cd: /path/to/project |
||||||
|
|
||||||
|
``` |
Loading…
Reference in new issue