Repository: kovidgoyal/kitty

Issue:
Error checking of args to `@ create-marker` is not correct
**Describe the bug**
It tells me that I must specify at least 2 arguments to create a marker; however, I think it should be at least 3 arguments.

**To Reproduce**
Steps to reproduce the behavior:
1. Launch kitty like this: `kitty --config NONE -o 'allow_remote_control yes'`.
2. `kitty @ create-marker text`
3. `kitty @ create-marker text 1`

  ```
  $ kitty @ create-marker text
  Error: Must specify at least 2 arguments to create_marker
  precor@byteevo:~$ kitty @ create-marker text 1
  Traceback (most recent call last):
    File "kitty/boss.py", line 682, in _execute_remote_command
    File "kitty/remote_control.py", line 220, in handle_cmd
    File "kitty/rc/create_marker.py", line 47, in response_from_kitty
    File "kitty/window.py", line 1700, in set_marker
    File "kitty/options/utils.py", line 332, in parse_marker_spec
  ValueError: No color specified in marker: 1
  
  Error: No color specified in marker: 1
  ```

**Environment details**
```
kitty 0.26.5 () created by Kovid Goyal
Linux byteevo 5.15.0-58-generic #64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023 x86_64
Ubuntu 20.04.5 LTS byteevo /dev/tty

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.5 LTS"
Running under: X11
Frozen: True
Paths:
  kitty: /home/precor/.local/kitty.app/bin/kitty
  base dir: /home/precor/.local/kitty.app/lib/kitty
  extensions dir: /home/precor/.local/kitty.app/lib/kitty-extensions
  system shell: /bin/bash
Loaded config overrides:
  allow_remote_control yes

Config options different from defaults:
allow_remote_control yes

Important environment variables seen by the kitty process:
	PATH                                /home/precor/.nvm/versions/node/v14.18.2/bin:/opt/qt/5.15.2/gcc_64/bin:/home/precor/.local/flutter/bin:/home/precor/.pub-cache/bin:/home/precor/Android/Sdk/build-tools/30.0.3:/home/precor/Android/Sdk/emulator:/home/precor/Android/Sdk/platform-tools:/home/precor/Android/Sdk/cmdline-tools/latest/bin:/home/precor/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
	LANG                                en_US.UTF-8
	SHELL                               /bin/bash
	DISPLAY                             :0
	USER                                precor
	XDG_CONFIG_DIRS                     /etc/xdg/xdg-ubuntu:/etc/xdg
	XDG_MENU_PREFIX                     gnome-
	XDG_SESSION_DESKTOP                 ubuntu
	XDG_SESSION_TYPE                    x11
	XDG_CURRENT_DESKTOP                 ubuntu:GNOME
	XDG_SESSION_CLASS                   user
	XDG_RUNTIME_DIR                     /run/user/1000
	XDG_DATA_DIRS                       /usr/share/ubuntu:/usr/local/share/:/usr/share/
```

**Additional context**
- Nightly release, generated on: 2023-01-26 21:44:14 UTC from commit: https://github.com/kovidgoyal/kitty/commit/5338fcdc1e9e02d957ba2fef26ca611bfe6fb778


Discussion:

Resolving patch:
diff --git a/kitty/options/utils.py b/kitty/options/utils.py
--- a/kitty/options/utils.py
+++ b/kitty/options/utils.py
@@ -329,13 +329,13 @@ def parse_marker_spec(ftype: str, parts: Sequence[str]) -> Tuple[str, Union[str,
         if ftype.startswith('i'):
             flags |= re.IGNORECASE
         if not parts or len(parts) % 2 != 0:
-            raise ValueError('No color specified in marker: {}'.format(' '.join(parts)))
+            raise ValueError('Mark group number and text/regex are not specified in pairs: {}'.format(' '.join(parts)))
         ans = []
         for i in range(0, len(parts), 2):
             try:
                 color = max(1, min(int(parts[i]), 3))
             except Exception:
-                raise ValueError(f'color {parts[i]} in marker specification is not an integer')
+                raise ValueError(f'Mark group in marker specification is not an integer: {parts[i]}')
             sspec = parts[i + 1]
             if 'regex' not in ftype:
                 sspec = re.escape(sspec)
diff --git a/kitty/rc/create_marker.py b/kitty/rc/create_marker.py
--- a/kitty/rc/create_marker.py
+++ b/kitty/rc/create_marker.py
@@ -29,7 +29,7 @@ class CreateMarker(RemoteCommand):
 type=bool-set
 Apply marker to the window this command is run in, rather than the active window.
 '''
-    args = RemoteCommand.Args(spec='MARKER SPECIFICATION', json_field='marker_spec', minimum_count=3)
+    args = RemoteCommand.Args(spec='MARKER SPECIFICATION', json_field='marker_spec', minimum_count=2)
 
     def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
         if len(args) < 2:


Test patch: