Commit graph

26 commits

Author SHA1 Message Date
Henrik Lissner
0e5935f0f7
fix(cli): "Argument list too long" error from after-scripts
Because a persisted envvar was larger than MAX_ARG_STRLEN (which is
typically ~2kb).
2024-09-13 23:07:13 -04:00
Henrik Lissner
771fccc52b
nit: minor reformatting & revision
Also corrects the version string of obsolete variable `+mu4e-backend`.
2024-09-11 19:46:14 -04:00
Henrik Lissner
2d3821741a
refactor(cli): introduce doom-cli-shell
Instead of constantly checking $__DOOMSH, since I may eventually add
additional values for it (like in the cases where the doom script is
invoked by bin/doomscript, from a terminal emulator in Emacs, or future
wrappers).
2024-09-07 13:52:25 -04:00
Henrik Lissner
73ab554566
fix(cli): don't auto-invoke pager under powershell
Need to find a pager that works on Windows.
2024-09-07 04:03:02 -04:00
Henrik Lissner
4c7aec35ba
fix(cli): envvar injection into bin/doom post-script 2024-09-07 02:42:34 -04:00
Henrik Lissner
f644c4fa6c
feat: add basic android support 2024-09-07 01:06:33 -04:00
Henrik Lissner
8d2cf32fef
feat(cli): add doom.ps1 for Windows users
c9acdb7 removes doom.cmd because it was broken in most cases. This adds
doom.ps1; an alternative script for Windows+Powershell users, which
properly initializes the state it needs. Naturally, it requires
Powershell 3+ be installed on your systems, but it can be invoked from
either cmd.exe or PowerShell.exe.

This is the first powershell script I've ever written, so I expect edge
cases (for one, shell commands passed to `exit!` will need to be guarded
against the environment).

This also requires emacs.exe be your $PATH, however, unless you set
$EMACS to its path first. E.g.

  $env:EMACS = "C:\Program Files\Emacs\emacs-29.4\bin\emacs.exe"

That said, if you use WSL2, you're still far better off using the bash
script (bin/doom).

Ref: c9acdb72a4
2024-09-07 01:05:57 -04:00
Henrik Lissner
76f7384621
fix(cli): "void-function: doom-modules-initialize" error
This reference to a function that doesn't exist (yet) snuck into
3bced4d.

Amend: 3bced4dbbe
2024-09-01 17:29:03 -04:00
Henrik Lissner
3bced4dbbe
refactor(cli): separate cli bootstrap from lib
Eventually, I want to autoload some of this stuff, so that users in
interactive sessions can safely load it without side effects (useful
when writing their own CLIs or editing Doom's source).
2024-09-01 14:45:52 -04:00
Henrik Lissner
948f9461a7
refactor(cli): merge doom-cli-lib into doom-cli
This was done to purge superfluous files from Doom's project structure
and simplify its entry points. And with early-init.el now acting as
Doom's universal bootstrapper (see c05e615), we don't have enough
bootstrap logic to warrant being its own file.

Also removes the redundant version check, given doom.el is assured to be
loaded before doom-cli, and performs its own check.

Ref: c05e61536e
2022-09-06 23:01:39 +02:00
Henrik Lissner
6dfed1ff47
refactor(cli): simplify struct definitions
There's no need to be this meticulous. It only pads the line count, and
for little merit.
2022-09-06 22:56:08 +02:00
Henrik Lissner
8971ee36e5
refactor(cli): use new API to write temp files
Ref: 8d4b6b3028
2022-09-06 22:56:03 +02:00
Henrik Lissner
c370cb1784
fix(cli): duplicate log files 2022-09-06 22:55:48 +02:00
Henrik Lissner
aef14f078d
feat(cli): add --benchmark switch 2022-09-06 22:55:48 +02:00
Henrik Lissner
a7e147088c
fix(cli): void-variable test error on Emacs 27.x
map.el integration for pcase wasn't introduced until 28.1; it was
premature to use it while we support 27.x.
2022-08-18 16:14:06 +02:00
Henrik Lissner
61ff5a4421
refactor(cli): set __DOOMCONTEXT at runtime
Addresses the edge case where the user sets (or unsets) __DOOMCONTEXT in
their CLI config.
2022-08-10 14:10:08 +02:00
Henrik Lissner
422baedad7
refactor(cli): load cli libs from doom.el
This simplifies the entry point for loading Doom (and/or its CLI
framework).
2022-08-07 19:43:28 +02:00
Henrik Lissner
b7b2563f7b
feat(cli): add implicit date, time, duration, & size types 2022-08-07 19:43:28 +02:00
Henrik Lissner
e5acbd7c40
docs(cli): make file/dir/stdout type errors consistent 2022-08-07 19:43:27 +02:00
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)