Skip to content

$_./ doesn't works ... others special vars with single car behind _. also #22

Open
@franck-gaspoz

Description

@franck-gaspoz

was thinking of a default in variable name parser, but seems it is just a lake of variable name searching in namespaces, like if the _ namespace if never scanned by search var function.
see the code:

OrbitalShell-Kernel/Component/Shell/Variable/Variables.cs

/// <summary>
/// search in variables the path according to these precedence rules:
/// - absolute path
/// - path related to Local
/// - path related to Env
/// - path related to Global
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public bool Get(string path, out object value, bool throwException = true)
{
    var r = _dataRegistry.Get(path, out value)
    || _dataRegistry.Get(Nsp(VariableNamespace.local, path), out value)
    || _dataRegistry.Get(Nsp(VariableNamespace.global, path), out value)
    || _dataRegistry.Get(Nsp(VariableNamespace.env, path), out value);
    if (!r && throwException)
        throw new VariablePathNotFoundException(path);
    return r;
}

there is no search in:

VariableNamespace._

what is strange is that search in absolute path failed for _.{..}

to reproduce:

> echo $_./

⚠️ the use of caracter '_' should be a source of councerns since it is also used as namespace separator encoding in Enums that define variables namespaces and names

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions