Skip to content

Bug: -r short flag has incorrect getopt definition (takes unintended argument) #148

@ToutEstNwaar

Description

@ToutEstNwaar

Description

The -r short flag for --raw is defined with a colon in the getopt string, meaning it expects an argument, but the case handler does not consume one.

Line 235:

local options=$(getopt -o hf:o:m:dszr:t: --long help,filename:,output-folder:,mode:,clipboard-only,debug,silent,freeze,raw,notif-timeout: -- "$@")

The -r: tells getopt that -r takes a required argument. But the case handler (line 268-269) just sets RAW=1 without shift:

-r | --raw)
    RAW=1
    ;;

This causes -r to silently consume the next argument. For example, hyprshot -m region -r may not work as expected because -r eats a subsequent positional value.

The long form --raw works correctly since it has no colon in the --long definition.

Fix

Change the getopt short options from:

-o hf:o:m:dszr:t:

to:

-o hf:o:m:dszrt:

(Remove the colon after r)

Environment

  • hyprshot 1.3.0-4
  • Arch Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions