Jump to content

Find, filter, open Git repositories


Recommended Posts

True, but it required a bit of searching to find the config now ;)

the problem was that somehow the default json editor of OSX used curved quotes (which was not visible in my font). Guess that teaches me to edit files with anything but Vim...

Guess I never do a regular open on json files...

Link to post
  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Alfred Git Repos Workflow   Browse, search and open Git repositories from within Alfred.     Download   Get the workflow from GitHub or Packal.   Usage   This workflow requires some configuration bef

Updated with some Alfred 3 goodness. Now auto-reloads results when an update completes Auto-updates list of repos when settings have changed Better handing of remote/origin URLs

Posted Images

Oh, right. TextEdit bit you, too, did it? The dumb "smart" quote thing is super annoying.

 

TBH, if Apple is going to set TextEdit as the default editor for JSON files, it should make sure it doesn't break them by default.

 

I'm looking into fixing things so the error in settings is caught like other errors. Might require quite a bit of work, though.

Link to post

Jup, TextEdit is really crappy... I've just replaced it with a symlink to Vim now ;)

As for the error, just having a default file and a try/catch around the loading of the personal settings file would help a bit already, but only for the reposettings command I guess.

Link to post

It's not that simple, I'm afraid.
 
The settings file is a part of the underlying Alfred-Workflow library (which is what also catches and displays the errors). I need to go through that carefully to ensure that the settings file isn't loaded by the library before the Workflow.run() method is called.
 
My suspicion is that the update functionality is doing it, but if that isn't the case, it may be tricky to also catch that error.

Edited by deanishe
Link to post

Looking at the traceback and the source, one (hacky) option could be to catch the creation of the workflow and trying it without the update:

i.e.:

try:
    wf = Workflow(default_settings=DEFAULT_SETTINGS,
                  update_settings=GITHUB_UPDATE_CONF,
                  help_url=HELP_URL)
except:  # Are there specific exceptions to catch here?
    wf = Workflow(default_settings=DEFAULT_SETTINGS,
                  help_url=HELP_URL)
Ok... somehow this forum screws up the indenting, but you get the point :) Edited by wolph
Link to post

The non-hacky solution is to modify Alfred-Workflow.
 
A slightly less hacky workflow-specific solution would have been to set Workflow._update_settings and call Workflow.check_update() from within main(), where it would have been subject to Workflow's error catching and logging.

Link to post
  • 7 months later...

Two cool new features added today, thanks to other GitHub users.

  1. git worktrees are now supported.
  2. If you configure a browser as one of your apps, the remote repo URL will be passed to it, instead of the local directory path.

Grab v1.7 from GitHub or Packal (or just enter repos workflow:update in Alfred).

Edited by deanishe
Link to post

I really love this workflow!!!
Added Google Chrome (opens bitbucket or github <3) and Tower (opens the repo in Tower <3<3)
PERFECT!
 
I just don't understand why it shows me the Git Root Folder (there is no .git directory or so).
 
see: second entry

http://i.dv.tl/Screenshot_2015-08-11_at_04.41.48.png

 

EDIT:

nevermind, there WAS a .git dir, I have no idea why :D removed and it works fine! thx

Edited by FirePanther
Link to post
  • 3 weeks later...

Weird story - I installed and depth wasn't deep enough, so I changed it and the update command didn't work, so I removed all the cache files (cpickle?) and now I'm getting this error and nothing works:

 

workflow.py:1978 ERROR    Command '[u'find', u'-L', u'/Users/user/Code/', u'-name', u'.git', u'-maxdepth', '5']' returned non-zero exit status 1

 

When I run the same command from the terminal it works.

 

Any suggestions? I tried reinstalling the workflow.

Link to post

That's a tricky one.
 
Does your username include any non-ASCII characters?
 
Are you definitely using the same find command (i.e. have you installed coreutils or the like from Homebrew)?
 
Perhaps try running the command from your terminal with an empty environment (env -i /usr/bin/find -L …) and see if that throws an error.

Link to post

My username only contains letters.

 

I tried running the command from the terminal, with "env -i", like you said and it worked.

 

I don't think I've replaced any core command line utils.

 

I want to stress the point that it worked once and gave me a list of repos with depth:2.

Link to post

I honestly don't know what the problem might be. I can't replicate it.
 
Could you create a new Run Script action in the workflow with language=bash and put the offending find command in it? Trigger that action and see what happens.
 
I suspect it may be a bad interaction between find and Alfred's empty environment.

Link to post

Oh, yeah. Find doesn't do excludes.

I don't have any other ideas at the moment. I suppose the workflow could check to see if find is producing valid output and use it regardless.

My gut feeling is still that having user-inaccessible folders/files under ~/ is the root problem.

Link to post

It's weird the script can't ignore the stderr.

I mean it's not like find itself crashes, just raises one stderr.

 

I know it's my fault, don't know why I keep bugging you :)

Thanks for your help, I'll fix it on my end, maybe my unit test could create that directory (probably makes more sense anyway).

 

EDIT: Now that it's working, I'm loving it so much!

Edited by Maddog
Link to post

It's weird the script can't ignore the stderr.

I mean it's not like find itself crashes, just raises one stderr.

The script does ignore STDERR. The issue is that find is exiting with a non-zero status (i.e. an error).

maybe my unit test could create that directory (probably makes more sense anyway).

I think that's probably the most correct solution. Having directories in ~/ that you can't open/read is a bit of an odd situation, and would presumably cause issues for backup software and Spotlight.

EDIT: Now that it's working, I'm loving it so much!

Thanks! Of all the workflows I've written, this is the one I use the most personally.

Link to post
  • 3 weeks later...

so it seems like a concept of "default editor" exists in git - https://help.github.com/articles/associating-text-editors-with-git/

 

Would be really nice instead of remembering the correct button, if it could just open the correct editor for the project.

 

I have projects in multiple languages and would be nice to be able to just hit enter instead of remembering the correct editor button.

 

Just a thought.

Link to post

But what does "$defaultEditor" refer to?
 
The git editor is what is used by git when it wants you to enter/edit a commit message. Changing that to something like Eclipse is probably not what you want, and you'll note that in the git docs that you linked to, when you specify a GUI editor, you also have to specify whichever flag they use to tell them to not exit till the file is closed (otherwise git will continue immediately).
 
In terms of repo-specific configuration, my preferred solution would be an alfred-repos.json file that overrides the "app_1", "app_2" etc. keys in the global configuration file.
 
Then you could execute echo '{"app_1": "Eclipse"}' > alfred-repos.json in your project directory to override the default action.
 
This has the advantage of enabling you to override all the app_* settings.

Edited by deanishe
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...