Skip to content

send: add a non-blocking option - #322

Merged
gauteh merged 1 commit into
gauteh:masterfrom
laarmen:non-blocking
Apr 21, 2026
Merged

send: add a non-blocking option#322
gauteh merged 1 commit into
gauteh:masterfrom
laarmen:non-blocking

Conversation

@laarmen

@laarmen laarmen commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

I personally prefer this operation to fail fast as sync operations sometimes take a lot of time.

I personally prefer this operation to fail fast as sync operations
sometimes take a *lot* of time.
@gauteh

gauteh commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Hi. If the default is True, and the switch sets it to True, wont it always be True..? Have you tested this?

@laarmen

laarmen commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

I actually added this for the --no-blocking option

@gauteh

gauteh commented Apr 21, 2026

Copy link
Copy Markdown
Owner

I actually added this for the --no-blocking option

The code says --blocking.

@laarmen

laarmen commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

BooleanOptionalAction gives you both the positive flag and its negative counterpart. I can implement it manually if you prefer, but flags cancelling each other are pretty handy in my experience.

❯ gmi send --help
usage: gmi send [-h] [-C PATH] [-c CREDENTIALS] [-s] [-q] [-v] [-d] [-i] [-t] [--blocking | --no-blocking] [-f I1] [recipients ...]

Read a MIME message from STDIN and send.

positional arguments:
  recipients            Recipients to send this message to (these are essentially ignored, but they are validated against the header fields.)

options:
  -h, --help            show this help message and exit
  -C, --path PATH       path
  -c, --credentials CREDENTIALS
                        optional credentials file for google api
  -s, --no-progress     Disable progressbar (always off when output is not TTY)
  -q, --quiet           Produce less output (implies -s)
  -v, --verbose         print list of changes
  -d, --dry-run         do not actually send message
  -i                    Ignored: always implied, allowed for sendmail compatibility.
  -t, --read-recipients
                        Read recipients from message headers. This is always done by GMail. If this option is not specified, the same addresses (as those in the headers) must be specified as additional arguments.
  --blocking, --no-blocking
                        Whether the call should block on other operations on the local repository, or error out. Defaults to blocking.
  -f I1                 Ignored: has no effect, allowed for sendmail compatibility.
  
❯ echo foo | gmi send -C /Users/schopin/Mail/personal/ -t --no-blocking
path: /Users/schopin/Mail/personal/
failed to lock repository (probably in use by another gmi instance)

(Also using #321 in this case)

@gauteh
gauteh merged commit d100817 into gauteh:master Apr 21, 2026
1 of 6 checks passed
@gauteh

gauteh commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Ok, good, thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants