technicalpickles / technicalpickles/homesick

Use wrappers around action methods to handle quiet/pretend invocation of commands

Open
#75 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactoring
Dominant language
Ruby
Stars
2.5k
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Here's an example of running grep say_status lib/homesick/actions.rb on homesick's source.

say_status 'git clone', "#{repo} to #{destination.expand_path}", :green unless options[:quiet]
say_status :exist, destination.expand_path, :blue unless options[:quiet]
say_status 'git init', '' unless options[:quiet]
say_status 'git init', 'already initialized', :blue unless options[:quiet]
say_status 'git remote', "add #{name} #{url}" unless options[:quiet]
# about 20 lines removed for brevity

The quiet and pretend options are often checked manually, which leads to fairly complex looking code.

Instead, I think it would be cleaner to use methods that handle quiet/pretend invocation for us. I vaguely remember seeing something in Thor's source code about a quiet? getter method that is used in say_status, but I couldn't figure out how to set this yet. It would be nice to use features built into Thor if there are any for this, but worst case we can add our own wrapper methods.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/homesick/actions.rb by reviewing the action methods and the repeated quiet/pretend checks shown in the issue. Then inspect Thor's support for quiet or pretend invocation before deciding whether existing features or wrappers fit. Done means the action methods use a consistent mechanism instead of manually checking these options, with behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.