 ;;; -*- lexical-binding: t; no-byte-compile: t; -*-
-
-(require 'map)
 
 ;; Eagerly load these libraries because we may be in a session that
 ;; hasn't been fully initialized (e.g. where autoloads files haven't

                        (opt (doom--cli-get-option cli fullflag)))
                   (unless opt
                     (user-error "Unrecognized switch %S" (concat "--" (match-string 2 arg))))
                   (map-put
                    alist (doom-cli-option-symbol opt)
                    (or (if (doom-cli-option-args opt)
                            (or (match-string 3 arg)
                                (pop args)
                                (user-error "%S expected an argument, but got none"
                                            fullflag))
                          (if (match-string 3 arg)
                              (user-error "%S was not expecting an argument, but got %S"
                                          fullflag (match-string 3 arg))
                            fullflag))))))

                ((string-match "^\\(-\\([a-zA-Z0-9]+\\)\\)$" arg)
                 (let ((fullflag (match-string 1 arg))
                       (flag     (match-string 2 arg)))
                   (dolist (switch (split-string flag "" t))
                     (if-let (opt (doom--cli-get-option cli (concat "-" switch)))
                         (map-put
                          alist (doom-cli-option-symbol opt)
                          (if (doom-cli-option-args opt)
                              (or (pop args)
                                  (user-error "%S expected an argument, but got none"
                                              fullflag))
                            fullflag))
                       (user-error "Unrecognized switch %S" (concat "-" switch))))))

                (arglist

    (when (< got expected)
      (error "Expected %d arguments, got %d" expected got))
    (when rest
      (setf (alist-get restvar alist) rest))
    alist))

(defun doom-cli-get (command)
