Skip to content

Owhab/Process-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Process Manager

A simple command-line process management application written in Go. This tool provides an interactive CLI for managing processes with basic lifecycle operations.

Features

  • Create new processes with custom names
  • List all managed processes with their status
  • Start processes by ID
  • Stop running processes
  • Delete processes from the manager
  • Interactive command-line interface
  • In-memory process tracking

Project Structure

process-manager/
├── main.go           # Application entry point
├── cli/
│   └── cli.go        # CLI interface and command handlers
├── manager/
│   └── manager.go    # Process manager logic
└── process/
    └── process.go    # Process model and lifecycle methods

Requirements

  • Go 1.25.5 or higher

Installation

  1. Clone the repository:
git clone <repository-url>
cd process-manager
  1. Build the application:
go build -o process-manager

Usage

Run the application:

./process-manager

Available Commands

Once the application is running, you'll see a ProcessManager > prompt. The following commands are available:

Create a Process

create <process-name>

Creates a new process with the specified name and assigns it a unique ID.

Example:

ProcessManager > create my-app
Created process 1

List All Processes

list

Displays all processes with their ID, name, and current status.

Example:

ProcessManager > list
1 | my-app | stopped
2 | web-server | running

Start a Process

start <process-id>

Starts a process by its ID. The process must be in a stopped state.

Example:

ProcessManager > start 1

Stop a Process

stop <process-id>

Stops a running process by its ID.

Example:

ProcessManager > stop 1

Delete a Process

delete <process-id>

Removes a process from the manager by its ID.

Example:

ProcessManager > delete 1

Exit

exit

Exits the application.

Example:

ProcessManager > exit
bye 👋

Architecture

Components

  • Process (process/process.go): Core data structure representing a process with properties like ID, name, status, and creation timestamp. Includes lifecycle methods (Start(), Stop()).

  • Manager (manager/manager.go): Manages the collection of processes. Handles CRUD operations and maintains unique process IDs.

  • CLI (cli/cli.go): Provides an interactive command-line interface. Parses user input and delegates operations to the manager.

Process Lifecycle

[Create] → [Stopped] ⇄ [Running]
              ↓
          [Delete]

Development

Building from Source

go build -o process-manager

Running Directly

go run main.go

Testing

go test ./...

Example Session

ProcessManager > create database
Created process 1
ProcessManager > create web-server
Created process 2
ProcessManager > list
1 | database | stopped
2 | web-server | stopped
ProcessManager > start 1
ProcessManager > start 2
ProcessManager > list
1 | database | running
2 | web-server | running
ProcessManager > stop 1
ProcessManager > delete 1
<nil>
ProcessManager > list
2 | web-server | running
ProcessManager > exit
bye 👋

Limitations

  • Processes are stored in memory only (data is lost when the application exits)
  • Process management is simulated (no actual OS process creation)
  • No persistence layer
  • Single-user, single-session design

Future Enhancements

  • Persist processes to disk (JSON, database, etc.)
  • Add process metadata (resource usage, logs, etc.)
  • Implement actual OS process spawning
  • Add configuration file support
  • Enhance error handling and validation
  • Add unit tests
  • Support for process groups and dependencies

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines on how to get started.

About

A simple command-line process management application written in Go. This tool provides an interactive CLI for managing processes with basic lifecycle operations.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages