|
4 | 4 |
|
5 | 5 | (require 'package) |
6 | 6 | (require 'project) |
| 7 | +(require 'url-vars) |
7 | 8 |
|
8 | 9 | (require 'cl-lib) |
9 | 10 | (require 'rect) |
|
59 | 60 | (nth 1 (eask--flag flag))) |
60 | 61 |
|
61 | 62 | ;;; Boolean |
62 | | -(defun eask-global-p () (eask--flag "-g")) ; -g is enabled |
63 | | -(defun eask-force-p () (eask--flag "-f")) ; -f is enabled |
64 | | -(defun eask-dev-p () (eask--flag "--dev")) ; --dev is enabled |
| 63 | +(defun eask-global-p () (eask--flag "-g")) ; -g, --global |
| 64 | +(defun eask-force-p () (eask--flag "-f")) ; -f, --force |
| 65 | +(defun eask-dev-p () (eask--flag "--dev")) ; --dev, --development |
| 66 | +(defun eask-debug-p () (eask--flag "--debug")) ; --debug |
65 | 67 |
|
66 | 68 | ;;; String (with arguments) |
67 | | -;; XXX Add string argument here if any! |
| 69 | +(defun eask-proxy () (eask--flag-value "--proxy")) |
| 70 | +(defun eask-http-proxy () (eask--flag-value "--http-proxy")) |
| 71 | +(defun eask-https-proxy () (eask--flag-value "--https-proxy")) |
| 72 | +(defun eask-no-proxy () (eask--flag-value "--no-proxy")) |
68 | 73 |
|
69 | 74 | ;;; Number (with arguments) |
70 | 75 | (defun eask-depth () (eask--str2num (eask--flag-value "--depth"))) ; --depth is enabled |
71 | 76 |
|
| 77 | +(defun eask--handle-global-options () |
| 78 | + "Handle global options." |
| 79 | + (when (eask-debug-p) (setq debug-on-error t)) |
| 80 | + (eask--add-proxy "http" (eask-proxy)) |
| 81 | + (eask--add-proxy "https" (eask-proxy)) |
| 82 | + (eask--add-proxy "http" (eask-http-proxy)) |
| 83 | + (eask--add-proxy "https" (eask-https-proxy)) |
| 84 | + (eask--add-proxy "no_proxy" (eask-no-proxy))) |
| 85 | + |
| 86 | +;; |
| 87 | +;;; Proxy |
| 88 | + |
| 89 | +(defun eask--add-proxy (protocal host) |
| 90 | + "Add proxy." |
| 91 | + (when host (push (cons protocal (eask-proxy)) url-proxy-services))) |
| 92 | + |
72 | 93 | ;; |
73 | 94 | ;;; Execution |
74 | 95 |
|
@@ -113,7 +134,10 @@ current workspace.") |
113 | 134 | other scripts internally. See function `eask-call'.") |
114 | 135 |
|
115 | 136 | (defconst eask--command-list |
116 | | - '("--eask-g" "--eask-f" "--eask--depth" "--eask--dev") |
| 137 | + (mapcar (lambda (elm) (concat "--eask" elm)) |
| 138 | + '("-g" "-f" "--depth" "--dev" |
| 139 | + "--proxy" "--http-proxy" "--https-proxy" "--no-proxy" |
| 140 | + "--debug" "--verbose" "--silent")) |
117 | 141 | "List of commands to accept, so we can avoid unknown option error.") |
118 | 142 |
|
119 | 143 | (defun eask-self-command-p (arg) |
@@ -193,6 +217,7 @@ Eask file in the workspace." |
193 | 217 | (user-init-file (locate-user-emacs-file "init.el")) |
194 | 218 | (custom-file (locate-user-emacs-file "custom.el"))) |
195 | 219 | (setq eask-file (expand-file-name "../../Eask" user-emacs-directory)) |
| 220 | + (eask--handle-global-options) |
196 | 221 | (ignore-errors (make-directory package-user-dir t)) |
197 | 222 | (eask--alias-env (load-file eask-file)) |
198 | 223 | (run-hooks 'eask-before-command-hook) |
|
0 commit comments