Skip to content

Commit

Permalink
docs(DevAPI): Add environment sections
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Dec 3, 2023
1 parent 9d2622b commit 130345b
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 15 deletions.
68 changes: 65 additions & 3 deletions docs/content/en/Development-API/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,70 @@ Command entry point. Each command file should contain this macro somewhere in th
)
```

# 🚩 Environment

## 🔍 Variable: eask-has-colors

Return non-nil if the terminal supports colors.

```elisp
(when eask-has-colors ...
```

## 🔍 Variable: eask-homedir

Eask's home directory path.

```elisp
(message "%s" eask-homedir)
```

## 🔍 Variable: eask-invocation

Eask's invocation program path.

```elisp
(message "%s" eask-invocation)
```

It could be the `node` executable or the `eask` executable itself.

## 🔍 Variable: eask-is-pkg

Return non-nil if Eask is packaged.

```elisp
(when eask-is-pkg ...
```

## 🔍 Variable: eask-rest

Eask's arguments after command separator `--'; return a list.

```sh
$ eask <command> -- args0 args1
```

Output:

```elisp
(message "%s" eask-rest) ; '(args0 args1)
```

## 🔍 Function: eask-rest ()

Eask's arguments after command separator `--'; return a string.

```sh
$ eask <command> -- args0 args1
```

Output:

```elisp
(message "%s" (eask-rest)) ; "args0 args1"
```

# 🚩 Core

## 🔍 Variable: eask-lisp-root
Expand All @@ -45,9 +109,7 @@ Points to `lisp` directory from the project root.

## 🔍 Function: eask-command ()

Return the current command in string.

Suppose the command is:
Return the current command in string. Suppose the command is:

```sh
$ eask init
Expand Down
68 changes: 65 additions & 3 deletions docs/content/zh-TW/Development-API/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,70 @@ weight: 700
)
```

# 🚩 環境

## 🔍 變數: eask-has-colors

如果終端支援顏色,則傳回非零。

```elisp
(when eask-has-colors ...
```

## 🔍 變數: eask-homedir

Eask 的主目錄路徑。

```elisp
(message "%s" eask-homedir)
```

## 🔍 變數: eask-invocation

Eask的呼叫程式路徑。

```elisp
(message "%s" eask-invocation)
```

它可以是 `node` 可執行檔或 `eask` 執行檔本身。

## 🔍 變數: eask-is-pkg

如果 Eask 已打包,則傳回非零。

```elisp
(when eask-is-pkg ...
```

## 🔍 變數: eask-rest

命令分隔符號 `--` 之後的 Eask 參數;傳回一個列表。

```sh
$ eask <command> -- args0 args1
```

輸出:

```elisp
(message "%s" eask-rest) ; '(args0 args1)
```

## 🔍 函式: eask-rest ()

命令分隔符號 `--` 之後的 Eask 參數;傳回一個字串。

```sh
$ eask <command> -- args0 args1
```

輸出:

```elisp
(message "%s" (eask-rest)) ; "args0 args1"
```

# 🚩 核心

## 🔍 變數: eask-lisp-root
Expand All @@ -44,9 +108,7 @@ weight: 700

## 🔍 函式: eask-command ()

返回字符串中的當前命令。

假設命令是:
返回字符串中的當前命令。假設命令是:

```sh
$ eask init
Expand Down
18 changes: 9 additions & 9 deletions lisp/_prepare.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
(declare-function ansi-white "ext:ansi.el")

;;
;;; Environments
;;; Environment

;; Determine the underlying operating system
(defconst eask-is-windows (memq system-type '(cygwin windows-nt ms-dos))
Expand Down Expand Up @@ -79,29 +79,29 @@ Arguments FNC and ARGS are used for advice `:around'."
(advice-add 'load :around #'eask--load--adv)

(defconst eask-has-colors (getenv "EASK_HASCOLORS")
"Return non-nil if terminal support colors.")
"Return non-nil if terminal supports colors.")

(defconst eask-homedir (getenv "EASK_HOMEDIR")
"Eask temporary storage.")
"Eask's home directory path.")

(defconst eask-invocation (getenv "EASK_INVOCATION")
"Eask invocation program.")
"Eask's invocation program path.")

(defconst eask-is-pkg (getenv "EASK_IS_PKG")
"Eask is pkg.")
"Return non-nil if Eask is packaged.")

(defconst eask-rest
(let ((args (getenv "EASK_REST_ARGS")))
(setq args (ignore-errors (split-string args ",")))
args)
"Eask arguments in list after command separator `--'.
"Eask's arguments after command separator `--'; return a list.
If the argument is `-- hello world'; it will return `(hello world)'.")
If the argument is `-- arg0 arg1'; it will return `(arg0 arg1)'.")

(defun eask-rest ()
"Eask arguments in string after command separator `--'.
"Eask's arguments after command separator `--'; return a string.
If the argument is `-- hello world'; it will return `hello world'."
If the argument is `-- arg0 arg1'; it will return `arg0 arg1'."
(mapconcat #'identity eask-rest " "))

(defcustom eask-import-timeout 10
Expand Down

0 comments on commit 130345b

Please sign in to comment.