Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add which command for printing full path to binary #73

Closed
wants to merge 1 commit into from

Conversation

LinusU
Copy link
Contributor

@LinusU LinusU commented Apr 5, 2018

Example usage:

$ mint which Carthage/Carthage@0.29.0 carthage
/usr/local/lib/mint/packages/github.com_Carthage_Carthage/build/0.29.0/carthage
$ mint which LinusU/RasterizeXCAssets 
/usr/local/lib/mint/packages/github.com_LinusU_RasterizeXCAssets/build/1.0.0-alpha.2/RasterizeXCAssets
$ mint which carthage                         
/usr/local/lib/mint/packages/github.com_Carthage_Carthage/build/0.29.0/carthage
$ mint which LinusU/NotFound        
🌱  Git repo not found at "https://github.com/LinusU/NotFound.git"

@toshi0383
Copy link
Contributor

which from UNIX doesn’t follow simlinks, does it?
Maybe it should be renamed to something else.

@yonaskolb
Copy link
Owner

@LinusU what's the motivation for a feature like this?

@toshi0383 good point, though this isn't following symlinks as it's the path used in mint run not the global install path

@LinusU
Copy link
Contributor Author

LinusU commented Apr 5, 2018

what's the motivation for a feature like this?

My main use case was being able to pass these paths into other programs that use the binary. e.g. passing the path to Carthage to XcodeGen.

@yonaskolb
Copy link
Owner

You should just be able to pass mint run {tool} and just call that instead of {tool}

@mrgrauel
Copy link

For fastlane usage it would be good to know the path.

@SpacyRicochet
Copy link

Seconding @mrgrauel's comment.

We'd like to use Mint in combination with Fastlane, but without linking the binaries globally, since they might conflict with other versions in use by other projects.

However, Fastlane isn't Mint-aware, so we can't for the swiftLint action to use mint run swiftlint. Instead, we could supply the path of the binary that would be used, but mint doesn't give us a way of retrieving that binary.

So, this PR would be a great addition in our opinion.

@sarastro-nl
Copy link

sarastro-nl commented Feb 6, 2020

For fastlane usage it would be good to know the path.

Absolutely true! Now I have this ugly hack in my Fastfile just to find out the path to swiftlint:

def lint
  swiftlint_directory = sh('sed -n -e "s/.*swiftlint@\(.*\)/\1/p" ../Mintfile | xargs find /usr/local/lib/mint -name | grep swiftlint | tr -d "\n"')
  swiftlint(
    executable: "#{swiftlint_directory}/swiftlint",
    config_file: "swiftlint.yml",
    strict: true,
    reporter: "junit",
    output_file: "output/swiftlint.junit"
  )
end

@yonaskolb
Copy link
Owner

I'll add this feature this weekend after #145

@yonaskolb yonaskolb mentioned this pull request Feb 9, 2020
@yonaskolb
Copy link
Owner

Reimplemented in #162
Thanks for the work here @LinusU!

@yonaskolb yonaskolb closed this Feb 9, 2020
@hilsenrat
Copy link

hilsenrat commented Jun 27, 2020

For anyone stumbling upon this PR, I execute Swiftlint (From a Mintfile) via Fastlane like that:

    SWIFTLINT_PATH = sh("mint which swiftlint -m ../Mintfile | tr -d '\n'")  
    swiftlint(  
      executable: "#{SWIFTLINT_PATH}"   
    )   

@ArtFeel
Copy link

ArtFeel commented Jun 18, 2021

@hilsenrat Thanks for tip with | tr -d '\n'!

I don't know why, but without that addition, sh action automatically execute binary for a path. For example this code:

lane :lint do
  sh("which brew")
end

Produce that output:

------------------------
--- Step: which brew ---
------------------------
$ which brew
▸ /usr/local/bin/brew
Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  brew update
  brew upgrade [FORMULA|CASK...]
  brew uninstall FORMULA|CASK...
  brew list [FORMULA|CASK...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants