Metadata-Version: 2.1
Name: pmflow
Version: 1.2.14
Summary: Manages processes
Author-email: "Md. Mahmudul Hasan Riyad" <mhriyad98@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Md. Mahmudul Hasan Riyad
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/mhriyad99/process_manager
Keywords: process manager,process,pm
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer==0.12.5
Requires-Dist: psutil==6.0.0
Provides-Extra: dev

# PMFlow
<p style="font-size:15px;">This is a simple process managing command line tool</p>

<p style="font-size:15px;">This tools keeps the information of the processes it manages in a json file created at it's installation location</p>

## Installation
```
pip install pmflow
```
Windows Installation: After installing pmflow with pip on windows make sure the path where the pm script is in the environment variable.

Use the below command in cmd to see the installation location of the pmflow
```
pip show pmflow
```
It should be something like ```C:\your\installation\location\Python\Python3<version>\site-packages```. In ```Python3<version>``` directory there should be a directory 
named ```scripts```. Make sure the path ```C:\your\installation\location\Python\Python3<version>\scripts``` is a environment variable and you should be good to go.
## Commands
### <^> Main commands
create: Creates a new process

Required arguments:
- command: str (default: None)

Optional arguments:
- --name or -n : str (default: None)
- --group or -g : str (default: process_id)
- --relation or -r : "parent" | "child" (default: "parent")
- --verbose or -v: (default: false)

Note: A child process must have a group name and the group must have a parent process.

Example:
```
pm create "<command>"
or
pm create "<command>" -n "<process name>" -g "<group name>" -r "child"
```
ls: List all managed processes

Optional arguments:
- --json or -j: bool (default: false)
- --group or -g: str (default: None)
- --running or -r: bool (default: false)
Example:
```
pm ls
pm ls -j
pm ls -g <group_name>
pm ls -j -g <group_name>
pm ls -r 
```
kill: Kill process, kills the process and also removes it from the json file.

Optional arguments:
- pid (no flag needed): int (default: 0) kills one process if it's a child process. Otherwise, kills the terminates 
- --group or -g: str (default: None) kills one group if exist
- --child or -c: bool (default: False) kills all child process in a group
- --all or -a : bool (default: false) kills all the process

Note: Other than -c only one options can be used at a time. -c flag must be used with -g

Example:
```
pm kill <PID>
pm kill -g <group_name>
pm kill -g <group_name> -c
pm kill -a
```
### <^> Additional commands
Recreate all process managed by the tool:
```
pm recreate
```
Pause a process
```
pm pause <PID>
```
respawn all paused process
```
pm respawn
```
