Rather than trying to re-invent the interactive shell-command-editor wheel, it might make more sense for the users to adapt to a slightly different procedure...

You already have a handy tool to read and execute commands via  while (<>), so think about storing one or more commands in a script file, and simply running your "CLI" tool with the script file as input (instead of the keyboard).

What you need to optimize is just the "edit/re-execute" loop. Do you have any sort of multi-window-display ability (or at least, multi-tasking job control within a single window)? Edit the file in one window, and each time you save it, re-run the command line (the same string) again to see what the output is.

(If you don't have multiple windows for multiple tasks, maybe you can run vim or dumb-term-mode emacs at the shell to edit/save the script, ^Z to background that and return to the shell so you can run the script, then "fg" to foreground the editor again as needed.)


In reply to Re: Shell style line-editing without benefit of CPAN modules by graff
in thread Shell style line-editing without benefit of CPAN modules by SirBones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.