Skip to content

Conversation

@gengelha
Copy link
Contributor

A new feature for fpp that would allow the user to take full advantage of the input selection GUI without being constrained to input with file paths.

For one small example, one could apply fpp to git branches:

# checkout selected branch
git branch | fpp -ai -c "git checkout --"

# delete selected branch
git branch | fpp -ai -c "git branch -D"

In "all input" mode, all lines are taken as valid input, assuming they contain more than just whitespace; each line is also trimmed of whitespace at its beginning and end.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could add an explanation that its helpful for things like git branches, mercurial bookmarks, maybe even directories -- who knows!

@pcottle
Copy link
Contributor

pcottle commented Nov 24, 2015

This is absolutely awesome! Really appreciate the thorough test coverage and cleanup along the way @gsheld. I'll take a deeper look tomorrow with some nits, but this can likely go in with minimal change.

I agree that combining with a preconfigured command mode is nice. maybe provide a few example commands for git to isolate the bookmarks? for example, mercurial outputs something like:

[pcottle:~/www:(explainNoMethods)]$ hg book
   betterStats.preamend      1095557:c0e02bfc109b
   debugSF                   1098767:f13654075612
   emailRoundups             1095558:6cd95011bcf3
 * explainNoMethods          1102007:d620f805c859

so if we matched on all text, you couldn't pipe it straight into hg update. git branch is a bit better but technically the currently checked out branch will have the * :P

also might have been nice to splice the file => path codemod into another PR, but nbd. im pretty lazy when interchanging the two, even though they arent technically equivalent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know this would pass, but maybe add a test case with whitespace on both sides, just for completeness

input: '   foo bar  ',
match: 'foo bar',

@pcottle
Copy link
Contributor

pcottle commented Nov 24, 2015

Alright more or less looked over everything -- some inline suggestions and nits that you can do in a followup (ideally), but this can go in! thanks again

pcottle added a commit that referenced this pull request Nov 24, 2015
@pcottle pcottle merged commit 94e3333 into facebook:master Nov 24, 2015
@gengelha
Copy link
Contributor Author

@pcottle Glad you liked the diff. I'll create another PR for cleanup when I have a chance. I actually found a small bug with the commit you just merged as well, so that will also be addressed in the next PR.

Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants