changeset 3406:4c15271118a2

core (constants): moved shell exit code constants to core constants: Well defined shell exit code are generally useful, not only for jp, thus constants have been moved to core.
author Goffi <goffi@goffi.org>
date Thu, 12 Nov 2020 14:53:15 +0100 (2020-11-12)
parents ecdb3728749e
children 2f0be2b7de68
files sat/core/constants.py sat_frontends/jp/constants.py
diffstat 2 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/constants.py	Thu Nov 12 14:53:15 2020 +0100
+++ b/sat/core/constants.py	Thu Nov 12 14:53:15 2020 +0100
@@ -375,6 +375,26 @@
     # internationalisation
     DEFAULT_LOCALE = "en_GB"
 
+    ## Command Line ##
+
+    # Exit codes used by CLI applications
+    EXIT_OK = 0
+    EXIT_ERROR = 1  # generic error, when nothing else match
+    EXIT_BAD_ARG = 2  # arguments given by user are bad
+    EXIT_BRIDGE_ERROR = 3  # can't connect to bridge
+    EXIT_BRIDGE_ERRBACK = 4  # something went wrong when calling a bridge method
+    EXIT_NOT_FOUND = 16  # an item required by a command was not found
+    EXIT_DATA_ERROR = 17  # data needed for a command is invalid
+    EXIT_MISSING_FEATURE = 18  # a needed plugin or feature is not available
+    EXIT_USER_CANCELLED = 20  # user cancelled action
+    EXIT_INTERNAL_ERROR = 111  # unexpected error
+    EXIT_FILE_NOT_EXE = (
+        126
+    )  # a file to be executed was found, but it was not an executable utility (cf. man 1 exit)
+    EXIT_CMD_NOT_FOUND = 127  # a utility to be executed was not found (cf. man 1 exit)
+    EXIT_CMD_ERROR = 127  # a utility to be executed returned an error exit code
+    EXIT_SIGNAL_INT = 128  # a command was interrupted by a signal (cf. man 1 exit)
+
     ## Misc ##
     SAVEFILE_DATABASE = APP_NAME_FILE + ".db"
     IQ_SET = '/iq[@type="set"]'
--- a/sat_frontends/jp/constants.py	Thu Nov 12 14:53:15 2020 +0100
+++ b/sat_frontends/jp/constants.py	Thu Nov 12 14:53:15 2020 +0100
@@ -73,21 +73,3 @@
     # Files
     A_DIRECTORY = A.BOLD + A.FG_CYAN
     A_FILE = A.FG_WHITE
-
-    # exit codes
-    EXIT_OK = 0
-    EXIT_ERROR = 1  # generic error, when nothing else match
-    EXIT_BAD_ARG = 2  # arguments given by user are bad
-    EXIT_BRIDGE_ERROR = 3  # can't connect to bridge
-    EXIT_BRIDGE_ERRBACK = 4  # something went wrong when calling a bridge method
-    EXIT_NOT_FOUND = 16  # an item required by a command was not found
-    EXIT_DATA_ERROR = 17  # data needed for a command is invalid
-    EXIT_MISSING_FEATURE = 18  # a needed plugin or feature is not available
-    EXIT_USER_CANCELLED = 20  # user cancelled action
-    EXIT_INTERNAL_ERROR = 111  # unexpected error
-    EXIT_FILE_NOT_EXE = (
-        126
-    )  # a file to be executed was found, but it was not an executable utility (cf. man 1 exit)
-    EXIT_CMD_NOT_FOUND = 127  # a utility to be executed was not found (cf. man 1 exit)
-    EXIT_CMD_ERROR = 127  # a utility to be executed returned an error exit code
-    EXIT_SIGNAL_INT = 128  # a command was interrupted by a signal (cf. man 1 exit)