+72
-21
lines changedFilter options
+72
-21
lines changed Original file line number Diff line number Diff line change
@@ -900,6 +900,31 @@ Report error/warning depends on strict flag.
900
900
901
901
See option [--strict](https://emacs-eask.github.io/Getting-Started/Commands-and-options/#---strict).
902
902
903
+
# ๐ฉ Exit Code
904
+
905
+
## ๐ Variable: eask--exit-code
906
+
907
+
Exit code specification.
908
+
909
+
## ๐ Function: eask-exit-code (&optional `key`)
910
+
911
+
Return the exit code by the key symbol in the variable `eask--exit-code`.
912
+
913
+
```elisp
914
+
(eask-exit-code 'misuse) ; by symbol
915
+
```
916
+
917
+
## ๐ Function: eask--exit (&optional `exit-code` &rest `_`)
918
+
919
+
Send exit code.
920
+
921
+
This will kill Emacs process.
922
+
923
+
```elisp
924
+
(eask--exit 2) ; by number
925
+
(eask--exit 'misuse) ; by symbol
926
+
```
927
+
903
928
# ๐ฉ Error Handling
904
929
905
930
## ๐ Variable: eask--ignore-error-p
@@ -947,12 +972,6 @@ Prevent Emacs from being killed and inhibit display error/warning messages.
947
972
(error "Nothing happens!"))
948
973
```
949
974
950
-
## ๐ Function: eask--exit (&optional `exit-code` &rest `_`)
951
-
952
-
Send exit code.
953
-
954
-
This will kill Emacs process.
955
-
956
975
# ๐ฉ File
957
976
958
977
## ๐ Function: eask-package-files ()
Original file line number Diff line number Diff line change
@@ -890,6 +890,31 @@ cat /.log/messages.log
890
890
891
891
่ฆ้ธ้
[--strict](https://emacs-eask.github.io/Getting-Started/Commands-and-options/#---strict).
892
892
893
+
# ๐ฉ ้ๅบไปฃ็ขผ
894
+
895
+
## ๐ ่ฎๆธ: eask--exit-code
896
+
897
+
้ๅบไปฃ็ขผ่ฆๆ ผใ
898
+
899
+
## ๐ ๅฝๅผ: eask-exit-code (&optional `key`)
900
+
901
+
ไปฅ่ฎๆธ `eask--exit-code` ไธญ็้้ต็ฌฆ่ๅๅณ exit codeใ
902
+
903
+
```elisp
904
+
(eask-exit-code 'misuse) ; ๆ็ฌฆ่
905
+
```
906
+
907
+
## ๐ ๅฝๅผ: eask--exit (&optional `exit-code` &rest `_`)
908
+
909
+
ๅณ้้ๅบไปฃ็ขผใ
910
+
911
+
้ๆ็ตๆ Emacs ็จๅบใ
912
+
913
+
```elisp
914
+
(eask--exit 2) ; ๆๆธๅญ
915
+
(eask--exit 'misuse) ; ๆ็ฌฆ่
916
+
```
917
+
893
918
# ๐ฉ ้ฏ่ชค่็
894
919
895
920
## ๐ ่ฎๆธ: eask--ignore-error-p
@@ -937,12 +962,6 @@ cat /.log/messages.log
937
962
(error "Nothing happens!"))
938
963
```
939
964
940
-
## ๐ ๅฝๅผ: eask--exit (&optional `exit-code` &rest `_`)
941
-
942
-
ๅณ้้ๅบไปฃ็ขผใ
943
-
944
-
้ๆ็ตๆ Emacs ็จๅบใ
945
-
946
965
# ๐ฉ ๆไปถ
947
966
948
967
## ๐ ๅฝๅผ: eask-package-files ()
Original file line number Diff line number Diff line change
@@ -1721,6 +1721,25 @@ For arguments MSG and ARGS, please see function `eask-msg' for the detials."
1721
1721
Argument ARGS are direct arguments for functions `eask-error' or `eask-warn'."
1722
1722
(apply (if (eask-strict-p) #'eask-error #'eask-warn) args))
1723
1723
1724
+
;;
1725
+
;;; Exit Code
1726
+
1727
+
(defconst eask--exit-code
1728
+
`((success . 0) ; Unused
1729
+
(failure . 1) ; Catchall for general errors
1730
+
(misuse . 2))
1731
+
"Exit code specification.")
1732
+
1733
+
(defun eask-exit-code (key)
1734
+
"Return the exit code by KEY symbol."
1735
+
(alist-get key eask--exit-code))
1736
+
1737
+
(defun eask--exit (&optional exit-code &rest _)
1738
+
"Kill Emacs with EXIT-CODE (default 1)."
1739
+
(kill-emacs (or (cond ((numberp exit-code) exit-code)
1740
+
((symbolp exit-code) (eask-exit-code exit-code)))
1741
+
(eask-exit-code 'failure))))
1742
+
1724
1743
;;
1725
1744
;;; Error Handling
1726
1745
@@ -1745,10 +1764,6 @@ Argument ARGS are direct arguments for functions `eask-error' or `eask-warn'."
1745
1764
(declare (indent 0) (debug t))
1746
1765
`(eask-ignore-errors (eask--silent-error ,@body)))
1747
1766
1748
-
(defun eask--exit (&optional exit-code &rest _)
1749
-
"Kill Emacs with EXIT-CODE (default 1)."
1750
-
(kill-emacs (or exit-code 1)))
1751
-
1752
1767
(defun eask--trigger-error ()
1753
1768
"Trigger error event."
1754
1769
(when (and (not eask--ignore-error-p)
@@ -1887,12 +1902,10 @@ the exit code. The default value `nil' will be replaced by `1'; therefore
1887
1902
would send exit code of `1'."
1888
1903
(let* ((command (eask-2str command)) ; convert to string
1889
1904
(help-file (concat eask-lisp-root "help/" command))
1890
-
;; The default exit code is `1' since `eask-help' prints the help
1905
+
;; The default exit code is `2' since `eask-help' prints the help
1891
1906
;; message on user error 99% of the time.
1892
-
;;
1893
-
;; TODO: Later replace exit code `1' with readable symbol after
1894
-
;; the exit code has specified.
1895
-
(print-or-exit-code (or print-or-exit-code 1)))
1907
+
(print-or-exit-code (or print-or-exit-code
1908
+
(eask-exit-code 'misuse))))
1896
1909
(if (file-exists-p help-file)
1897
1910
(with-temp-buffer
1898
1911
(insert-file-contents help-file)
You canโt perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4