Command line input

Issue #123 resolved
Jim U created an issue

Command line input similar to Unix shell echo -n and read commands:

Comments (8)

  1. Yusuf Ismail repo owner

    A ReadInput action is planned which would allow you to do the following

    string name
    yield return new ReadInput(s => name = s);
    

    This isn’t _quite_ the same though as it would use the standard input field rather than being inline, which means it also wouldn’t support a non echo mode

    Perhaps there’s a nice way to support this more directly too, but nothing crosses my mind yet

  2. Yusuf Ismail repo owner

    Hmm, so displaying extra text in the input field itself; certainly an interesting idea

  3. Jim U reporter

    I think modifying the appearance of the input field makes it clear that its function has changed; it no longer processes commands.

    Since data-entry fields typically have labels that are positioned left-of or above them, I placed the label left of it.

    When I tried placing the rounded rectangle outside the input field, it looked too much like a button. Placing it in the field also makes it clearer that it’s related to the data field.

    Alternative:

  4. Yusuf Ismail repo owner

    Agreed, personally I think the first mockup is much nicer.

    With regards to the “get input“ API in general, perhaps the QuantumConsole could have a function of this nature

    void RequestInput(Action<string> onSubmit);
    

    This would then put QC into a different “waiting input“ mode, where the next input will be sent into that callback instead of the normal command processor. Theres some caveats to think about though and I don’t want to rush into a poor design for implementation. That API could then neatly be expanded in the future without breaking backwards compatibility with stuff like

    void RequestInput(Action<string> onSubmit, string prefix, Flags flags)
    

    Where flags would allow you to do things like no echo or password mask

  5. Frank Taylor

    This could be rolled in with issue #134 where a command like “say” could be set as the default. If QC was being used as a chat window as suggested there, then it would be a simple matter of switching between default actions like “say”, “whisper”, “party”, etc.

  6. Log in to comment