sarbian/ModuleManager

"add only if missing" feature request

Closed this issue · 7 comments

do not take this as an issue or anything, just a simple suggestion
if you have the time to do something like this I would really apreciate it, otherwise no hurt feelings :D

basically, I'd like to have an operation that adds a variable only if it's missing
example:

starting from this nodes

TESTNODE
{
    name = first
    notmissing = true
}
TESTNODE
{
    name = second
}
TESTNODE
{
    name = third
    notmissing = true
}

to add "notmissing = true" to the second node I would need to use this:

@TESTNODE:HAS[~notmissing[*]]
{
    notmissing = true
}

this will check all the nodes and add notmissing = true only to those without it.

this is fine when you have only 1 variable to check, but when (like in my case) there are many different values to check, the lenght of the cfg increases a lot.

it would be nice to have an operator (let's say §) that adds a variable only if it's missing so I could do something like this:

TESTNODE
{
    notmissing1 = true
    notmissing3 = true
    notmissing5 = true
}
@TESTNODE
{
    §notmissing1 = true
    §notmissing2 = true
    §notmissing3 = true
    §notmissing4 = true
    §notmissing5 = true
}

needs to be a symbol thats readily on keyboards, and preferably american :)
@ ! % are used for add, delete, add/edit, but no add if not exist :(
so i second this idea, wonder if # works?

@anxcon # is already used for copying modules,

maybe ~ ?

btw, you can get the symbol relatively easily by typing [ALT]+[0][1][6][7]
not the easieast character, but most of the easy ones are already taken :D
maybe ^ or ? could work

KSP is so peculiar about what it want to load that the only way to know what works is to test. In the last patch I wanted to use '>' and found out that KSP would ignore it...

@sarbian if you need help with testing the feature feel free to ping me.
have you ever tried "|" ? (I think it's called "straightpipe")
the only other symbols I can see on my keyboard that I don't think are used are £ $ € ^ °

accualy if ? can pass ksp, i vote for it
?title = This is default title

looks like this was added in 2.6.23 am I right? so I guess I can close the issue right?

We can