Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    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 .
    I'd expect pressing 1 to automatically choose "A"
    Piotr Murach
    @piotrmurach
    @Eiam8821 You're right, this is only supported by enum_select and expand prompts. There is an piotrmurach/tty-prompt#151 and a piotrmurach/tty-prompt#152 where this feature is discussed. I cannot tell you when this will be done.
    @ajmarkow The default help implementation comes from the Thor which the CLI inherits from.
    Piotr Murach
    @piotrmurach
    @sebastian-schuth When you invoke a command with backticks, it's run in another process that knows nothing about your Webmock/VCR setup. One solution is to, for example, spin up a mock server that sends a canned response whenever your executable issues a particular request. A long time ago I wrote a gem communist which helped me do just that inside cucumber stories. It would spin a server on localhost before each feature test that would intercept requests and return response described in a cucumber feature.
    1 reply
    Zane
    @ZASMan
    Hi guys I'm having some trouble using tty out of the box. I just have a simple ruby script and I required it at the top and these are the errors I get:
    require 'git'
    require "tty-prompt"
    
    repo_name_list = ['repo_name_1', 'repo_name_2']
    prompt = TTY::Prompt.new
    prompt.multi_select("Which repos would you like to clone locally?", repo_name_list)
    # NoMethodError: undefined method `disabled?' for nil:NilClass
    prompt.enum_select("Which repos would you like to clone locally?", repo_name_list)
    # NoMethodError: undefined method `disabled?' for nil:NilClass
    Doug Hughes
    @dhughes
    Hello friends. I'm working with TTY::ProgressBar::Multi and was wondering if there was an off the shelf way to clear registered/child bars when they complete? I've tried adding clear: true to both the new instance of TTY::ProgressBar::Multi and as an option provided to #register. Neither of these have any impact as the progress bars finish.
    Piotr Murach
    @piotrmurach
    @ZASMan The provide snippet doesn't raise any errors and works as expected. I also attached examples to confirm correct behaviour in the piotrmurach/tty-prompt#158 report.
    @dhughes That looks like a bug. Would you mind submitting an issue report here https://github.com/piotrmurach/tty-progressbar? Thanks
    Francisco Diaz
    @fdiaz

    Hi folks! I'm trying to find a way to not use the space character as selection when filtering a list using select. I'm using select for a list of names that have spaces in them (e.g.team_names = ["Some Team", "Some Team: SubTeam"]). When the user types "Some " the prompt selects the first instance and I want it to continue filtering using the space.

    I'm using prompt.select('Select your team name:', team_names, filter: true).

    I tried using prompt.select('Select your team name:', team_names, filter: true, keys: [:return]) but that didn't work. Is there another option I should be passing here? I'm using v 0.18.1

    Thanks!

    Piotr Murach
    @piotrmurach
    @fdiaz Hi there, please submit an issue over at the GitHub project issue tracker here https://github.com/piotrmurach/tty-prompt/issues so we can discuss and find a solution. I'd like this to be fixed. Also please try upgrading to version 0.23.0 before you report. Thank you.
    Francisco Diaz
    @fdiaz
    Will do! Thanks