Skip to content

/rfg profile <name> fails for profiles with whitespaces #1

Description

@a-cid

Summary

When attempting to switch active profiles using /rfg profile <name>, profile names with spaces (e.g., /rfg profile Two Words) fail to be selected. Instead of loading the profile, the command prints the usage instructions. Since auto generated profiles include whitespaces, this bug makes creating macros to change to them impossible.

Location

File: Compare/10_config.lua (lines 336–352)

Cause

In SlashCmdList.REFACTORGEAR, line 336 parses rest using rest:match("^(%S*)%s*(.-)$") to extract sub and name:

local sub, name = rest:match("^(%S*)%s*(.-)$")

For /rfg profile Two Words:

  • sub becomes "Two"
  • name becomes "Words"

When checking whether sub is a standalone profile name:

elseif sub ~= "" and name == "" then

The check fails because name is "Words" instead of "". Because no preceding sub-commands (list, save, delete) matched either, execution falls through to the final else block, displaying the profile usage string.

Steps to Reproduce

  1. Create a profile containing a space (e.g., /rfg profile save Two Words).
  2. Switch to a different profile.
  3. Attempt to load the original profile using /rfg profile Two Words.
  4. Observe that the command prints usage: /rfg profile <name> | save <name> | delete <name> | list instead of switching profiles.

Suggested Fix

Update the fallback branch in the cmd == "profile" block to inspect rest directly rather than requiring name == "":

elseif subl == "delete" and name ~= "" then
    if RefactorGearDB.profiles[name] then
        DeleteProfile(name)
    else
        Print("no profile named '" .. name .. "'.")
    end
elseif rest ~= "" then
    if RefactorGearDB.profiles[rest] then
        SetActiveProfile(rest)
        C.RefreshOpenBags()
        C.RefreshConfig()
        Print("switched to profile '" .. rest .. "'.")
    else
        Print("no profile named '" .. rest .. "'. /rfg profile save " .. rest .. " to create it.")
    end
else
    Print("usage: /rfg profile <name> | save <name> | delete <name> | list")
end

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