Commit graph

7 commits

Author SHA1 Message Date
Henrik Lissner
d53e08767d
feat(cli): add stdout implicit arg type
CLIs can now use this for implicit validation for options that take a
file path or - to signal "print to stdout", like so:

  (defcli! (doom command) ((outfile ("--out" (file stdout))))
    (if (equal outfile "-")
        (print! "output")
      (with-temp-file outfile
        (insert "output"))))

If OUTFILE is not an existing file path or a -, you'll see an this
helpful error:

  Error: -o/--file received invalid value "FOO"

  Validation errors:
  - Must be a dash to signal stdout.
  - File does not exist.

  See 'doom h[elp] make codeowners' or 'doom make codeowners {-?,--help}' for documentation.
2022-08-07 19:43:27 +02:00
Henrik Lissner
26bc4ea150
feat(cli): allow multiple implicit types for options
Now you can specify more than one allowed (implicit) for a CLI option:

  (defcli! (doom somecommand) ((foo ("--foo" (file int)))))

This will test FOO to ensure it is either an existing file path or an
integer. If neither is true, you'll see this helpful error:

  Error: -o/--file received invalid value "FOO"

  Validation errors:
  - Not an integer.
  - Not a valid path to an existing file.
2022-08-07 19:43:27 +02:00
Henrik Lissner
057e6c531c
refactor: replace doom-enlist with ensure-list
doom-enlist is now a deprecated alias for ensure-list, which is built
into Emacs 28.1+ and is its drop-in replacement. We've already
backported it for 27.x users in doom-lib (in 4bf4978).

Ref: 4bf49785fd
2022-08-07 19:43:13 +02:00
Henrik Lissner
0ed2b95dba
refactor(cli): include envvars in _doomrun debug logs 2022-08-06 18:43:14 +02:00
Henrik Lissner
2254b8c561
fix(cli): doom-cli-context persistence
20d5440 introduced a regression where options would be lost when a CLI
session is restarted. :config literate users, for example, would run
'doom sync -u' only for the -u option to be ignored, because it was
discarded after the literate module restarts the session.

Amend: 20d5440023
2022-08-05 00:49:17 +02:00
Henrik Lissner
4ee7f0113e
fix(cli): show straight logs after straight error
Instead of displaying an unhelpful backtrace about failed git commands,
show the tail of the *straight-process* buffer.
2022-07-31 23:44:10 +02:00
Henrik Lissner
b9933e6637
refactor!: restructure Doom core
BREAKING CHANGE: This restructures the project in preparation for Doom
to be split into two repos. Users that have reconfigured Doom's CLI
stand a good chance of seeing breakage, especially if they've referred
to any core-* feature, e.g.

  (after! core-cli-ci ...)

To fix it, simply s/core-/doom-/, i.e.

  (after! doom-cli-ci ...)

What this commit specifically changes is:
- Renames all core features from core-* to doom-*
- Moves core/core-* -> lisp/doom-*
- Moves core/autoloads/* -> lisp/lib/*
- Moves core/templates -> templates/

Ref: #4273
2022-07-30 22:41:13 +02:00
Renamed from core/core-cli-lib.el (Browse further)