Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Mads Ohm Larsen
    @omegahm
    @piotrmurach Hi Piotr. I first want to say thanks for a great project! I just love the ease that tty-* gives me to make nice CLI.
    When using teletype to create a project, it creates a templates folder within lib/PROJECT. What is this meant for?
    Pranav Goswami
    @prango
    @piotrmurach Hi Piotr ! Amazing gem :) Just wanted to ask is there way to pipe TTY::Prompt output to LOG ? Right now the way i am doing in building warper around to and Logging args and answers.
    🐔🍷 The Journal of Unciteable Scholarship
    @anbayanyay_twitter
    Hi @piotrmurach , thanks for the great code! I am having an issue, though, with tty::reader through a gserver socket.
    🐔🍷 The Journal of Unciteable Scholarship
    @anbayanyay_twitter
    Hi @piotrmurach , thanks for the great code! I am having an issue, though, with tty::reader through a gserver socket. I start the reader with: rio = TTY::Reader.new(input: sio, output: sio) and I read lines with readline = rio.read_line("\r#{serverIdentifier}:>") ... What happens is when a user telnets to the server, each time they type a character, the prompt and their input is tabbed 8 spaces right. I love the previous command retrieval, and if I could get this glitch straightened out, I would be ecstatic! Do you have suggestions for me to try? Many thanks.
    🐔🍷 The Journal of Unciteable Scholarship
    @anbayanyay_twitter
    I solved this tab issue by adding the raw option to the read_line call. Happy as a clam! Thanks again.
    b1tt
    @b1tt0
    hi! im having troubles with tty-cursor running on zsh. it seems to do nothing
    Piotr Murach
    @piotrmurach
    @prango The initializer accepts :output option which accepts stream like objects. However, I must warn you that the output from TTY::Prompt would be extremely verbose including many terminal control characters. Not sure this is what you need.
    @anbayanyay_twitter This issue is not specific to TTY::Reader. This is to do with cooked vs raw terminal mode. Even if you use Ruby's getc method you will get similar behaviour. Had a similar issue recently to do with TTY::Prompt behaviour (see piotrmurach/tty-prompt#137). Glad you managed to figure this out!
    @b1tt0 I can assure you that TTY::Cursor works fine. Please make sure that you print cursor content to the terminal (read https://github.com/piotrmurach/tty-cursor#1-usage)
    Adam Fleishaker
    @afleishaker
    Heya all, is it still the case that tty-prompt and tty-box are incompatible together out of the box without major overhaul?
    Adam Fleishaker
    @afleishaker
    And a followup, is progressbar able to returned without printing?
    Daniel Vartanov
    @DanielVartanov
    @afleishaker I've used them both in my last project, they work fine. I wonder what was the problem in the past? I don't see a reason of their incompatibility in the code
    Adam Fleishaker
    @afleishaker
    I was able to wrap box in a prompt and that worked out. Don't know, but if you scroll up to Jun 2019 it's written here.
    Piotr Murach
    @piotrmurach
    @afleishaker What do you mean by 'returned without printing' ? You can control where the output goes with :output. This means you can redirect it to anything that responds to print message. The :clear option helps you to remove the progress bar when it is done.
    Keil Miller Jr
    @keilmillerjr_gitlab
    Hello. Would it be possibly to invoke an instance of a ruby app remotely? Via web browser? Access tty in a manner of terminal to mainframe.
    Daniel Vartanov
    @DanielVartanov
    @keilmillerjr_gitlab Usage of a browser requires some sort of HTTP server on that side, it's quite cumbersome, but still possible, may be there are open source implementations of that out there already. I don't know your circumstances, but perhaps the easiest way of running a terminal app remotely is SSH
    narutaro
    @narutaro
    Hi let me ask a question:
    I overwrote a command description from "desc A" to "desc B" but it did not work. Am I doing wrong...?
    macbook:app masaino$ ruby -v
    ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
    macbook:app masaino$ teletype -v
    v0.10.0
    macbook:app masaino$ uname -a
    Darwin macbook.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
    
    macbook:app masaino$ teletype add com --desc 'desc A'
          create  spec/integration/com_spec.rb
          create  spec/unit/com_spec.rb
          create  lib/app/commands/com.rb
          create  lib/app/templates/com/.gitkeep
          inject  lib/app/cli.rb
    macbook:app masaino$ teletype add com --desc 'desc B' --force
           force  spec/integration/com_spec.rb
       identical  spec/unit/com_spec.rb
       identical  lib/app/commands/com.rb
       identical  lib/app/templates/com/.gitkeep
    macbook:app masaino$ exe/app
    Commands:
      app com             # desc A
      app help [COMMAND]  # Describe available commands or one specific command
      app version         # app version
    narutaro
    @narutaro
    ah, sorry understand that it doesn't update lib/app/cli.rb
    Piotr Murach
    @piotrmurach
    @narutaro The teletype isn't yet that smart to figure this out, unfortunately. When you come across things that could be improved or have suggestions please post them on the project issues tracker or even better submit a pull request. At the moment I'm updating all tty components and working on the tty itself to provide a bit smoother experience in v0.11.0.
    narutaro
    @narutaro
    @piotrmurach - Thank you!
    Andy Maleh
    @AndyObtiva
    Thank you for the wonderful tty-prompt and tty-screen gems. I just built these TUIs with them: https://github.com/AndyObtiva/rake-tui / https://github.com/AndyObtiva/rvm-tui
    Piotr Murach
    @piotrmurach
    @AndyObtiva That's great!
    Eddy Kim
    @edk11_gitlab
    i came here with a question, but just figured it out. Thanks Piotr for the great libraries, i use them all the time! beats writing everything in choice or curses :)
    Piotr Murach
    @piotrmurach
    @edk11_gitlab That's awesome to hear!
    inyerade
    @inyerade
    Hi @piotrmurach , I have question about tty-option. In https://github.com/piotrmurach/tty-option#2510-validate say Will internally cause an exception TTY::Option::InvalidArgument that will make params invalid. but I execute the same first example and dont get a exception
    inyerade
    @inyerade
    I have to change validate "\d+" with validate /\d+/ and add convert :int and then the validate? command give me false but yet not get the exception
    Piotr Murach
    @piotrmurach
    Hi @inyerade, one of the 'features', as explained in the readme docs, is that "Parsing doesn't raise errors by default and collects issues to allow for better user experience." The sentence that you cited "Will internally cause an exception TTY::Option::InvalidArgument that will make params invalid. " means that inside the TTY::Option the specific error is raised that makes the params invalid but no actual errors are raised. I would suggest reading parse method section and params section. I wrote the Readme to document all the APIs and usage but please free to submit PR if something is missing or not clear enough. I'm keen to make sure the docs are complete and easy to use.
    Jeffrey LI
    @JeffreyArtworks

    help needed: for some reason, I "gem install tty" but don't get "teletype" as a new command.

    effrey@Mac-mini youtube % gem install tty
    Successfully installed tty-0.10.0
    Parsing documentation for tty-0.10.0
    Done installing documentation for tty after 0 seconds
    1 gem installed
    jeffrey@Mac-mini youtube % teletype new app
    zsh: command not found: teletype

    Piotr Murach
    @piotrmurach
    @JeffreyArtworks Unfortunately, this is not an issue related to tty gem. I verified by installing v0.10.0 that the teletype executable works as expected. I'd potentially look into reinstalling Ruby version that you're using. However, this is an issue for yourself to figure out why your system fails to find Ruby installed executables.
    Muhammad Adeel Danish
    @bashforger
    Hi @piotrmurach thank you for your amazing work. I am having exactly the same issue as @JeffreyArtworks stated. It may be a problem with zshteminal.
    Muhammad Adeel Danish
    @bashforger
    In my case I solved it by exporting GEMS USER INSTALLATION DIRECTORY export PATH="$HOME/.gem/ruby/2.7.0/bin":$PATH in .zshrc
    Piotr Murach
    @piotrmurach
    @bashforger Thank you! I'd also consider using tools like rbenv that will handle all the switching between Ruby versions and binaries a far better experience than doing it manually.
    Janav Nagapatla
    @jan-sudoer

    Hi @piotrmurach, TTY Toolkit is great and thank you for saving a lot of our time. However, I have a small problem. I can't figure out how to send the user input from

    prompt.ask(">>") do |q|
      q.validate(/(close)|(\A[0-9]+(\.[0-9]+)?[\+\-\*\√][0-9]+(\.[0-9]+)?\z)/, "Invalid question, #{ENV["USER"].capitalize}. Try again.\a")
    end

    to a global variable. How may I do this?

    Piotr Murach
    @piotrmurach
    @jan-sudoer The prompt.ask method returns the processed input so you need to assign the result to some variable like some_var = prompt.ask(">>").....
    Janav Nagapatla
    @jan-sudoer
    Oh. Thanks @piotrmurach. Silly of me not to have seen the assigning part in your examples.
    William
    @WilliamMcCumstie
    @piotrmurach Been awhile since I've checked out TTY::Table, I was wondering what is the status of getting the following merged:
    piotrmurach/tty-table#36
    Piotr Murach
    @piotrmurach
    @WilliamMcCumstie Thanks for chasing. I haven't worked on tty-table recently as I needed to release other tty gems. There is a backlog I'm working through. I'll try to review it soon.
    AJ
    @ajmarkow
    Hi all, I've set up a command, i have methods its supposed to execute, but when i run teletype -r setup which is the name of my command, I just get could not find command setup. Something i'm doing wrong here?
    I will buy 🍺 if you help me get a handle on this. Or a :coffee:
    AJ
    @ajmarkow
    Ahh seeing an answer from 2018 now, I need to call the executable first.
    Piotr Murach
    @piotrmurach
    @ajmarkow Please provide a link to your repository if it's open-sourced and I can take a quick look and offer some suggestions. In general teletype will scaffold your application and add commands but once this is done, you need to run your executable directly.
    AJ
    @ajmarkow
    Thanks Piotr ! Did have one other question which is where the -h flag gets it's initial configuration from. I see the following and i'm not sure how to modify it
    # Describe available commands or one specific command.
    I'm seeing most of it lives in cli.rb but not where that is inherited from
    Sebastian Schuth
    @sebastian-schuth
    Hey! we have created our own tooling for interacting with a lot of github repos, based on tty. We love it so far, and want to extend the tooling now. As we access the github api often and need some prepared data for tests, I want to use WebMock/VCR to mock the GH api. Now, generated tests in RSpec use a :cli type and backticks to invoke the command, enabling us to check the output, exactly like I want it, but: webmock and VCR do not work when invoking the cli via backticks, it seems. Any ideas how to do this?
    an example, I want to do sth like this:
    RSpec.describe "`parc-cli version` command", type: :cli do
      it "executes `parc-cli version --check` command successfully" do
        VCR.use_cassette("version-check") do
          output = `parc-cli version --check`
          # assert here
        end
      end
    end
    This does not work -- calling the command directly works as expected.
    Eiam8821
    @Eiam8821
    According to the docs I can use the key property to specify a key press, but I find that only works if I set .enum_select or .expand, not when I specify it directly via .select https://gist.github.com/Eiam8821/1cda292f5d875f461b99647d19b0b28c .