From c89f99286711f2c7a6ee9803552471d0fd3522bc Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <fabio@manganiello.tech>
Date: Sun, 13 Aug 2023 23:36:36 +0200
Subject: [PATCH] Added `StopCommand` and `RestartCommand`.

---
 platypush/commands/_commands/__init__.py  |  2 ++
 platypush/commands/_commands/_app_ctrl.py | 25 +++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 platypush/commands/_commands/__init__.py
 create mode 100644 platypush/commands/_commands/_app_ctrl.py

diff --git a/platypush/commands/_commands/__init__.py b/platypush/commands/_commands/__init__.py
new file mode 100644
index 000000000..22cdf7bec
--- /dev/null
+++ b/platypush/commands/_commands/__init__.py
@@ -0,0 +1,2 @@
+# flake8: noqa
+from ._app_ctrl import *
diff --git a/platypush/commands/_commands/_app_ctrl.py b/platypush/commands/_commands/_app_ctrl.py
new file mode 100644
index 000000000..780d8b15c
--- /dev/null
+++ b/platypush/commands/_commands/_app_ctrl.py
@@ -0,0 +1,25 @@
+from typing_extensions import override
+
+from platypush.commands import Command
+
+
+class StopCommand(Command):
+    """
+    Stop the application.
+    """
+
+    @override
+    def __call__(self, app, *_, **__):
+        self.logger.info('Received StopApplication command.')
+        app.stop()
+
+
+class RestartCommand(Command):
+    """
+    Restart the application.
+    """
+
+    @override
+    def __call__(self, app, *_, **__):
+        self.logger.info('Received RestartApplication command.')
+        app.restart()