A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/emacs-eask/cli/commit/c49f53caa1f6ac94a9c8c884d70d0860f55728c1 below:

Add specify exit code ยท emacs-eask/cli@c49f53c ยท GitHub

File tree Expand file treeCollapse file tree 3 files changed

+72

-21

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+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