Add pyinstaller step

This commit is contained in:
Digital Studium
2023-04-09 20:34:41 +03:00
parent b0cc18dc8e
commit 0682ac8961
2 changed files with 30 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ COMMANDS
A method for getting kernel version
```
## Making the tool more complex
## Step 3. Making the tool more complex
For example, we also want our tool to be able to print the kernel version in short form, like this: `6.2.2`.
We rewrite the code as follows:
```python
@@ -124,4 +124,17 @@ FLAGS
-f, --format=FORMAT
Type: ('short', 'full')
Default: 'full'
```
```
## Step 4. Create a binary file
First install `pyinstaller`:
```bash
pip install pytinstaller
```
Then we run the command:
```
pyinstaller my-cli-tool --onefile
```
A folder `dist` shoud appear, and a binary file `my-cli-tool` inside it with all dependencies, which can be used even on servers,
which do not have python or fire installed. Just put this file in the path `/usr/local/bin` and `my-cli-tool` can be used!