Jump to content

SourceTree Workflow


Saiya

Recommended Posts

Search bookmarks in SourceTree and launch them in Alfred.

 

Features

  1. support fuzzy search
  2. can open repo in your code editor directly by press cmd + enter, using VS Code by default, you can custom it
  3. can reveal repo in find by press option + enter

 

 

get this workflow from:  https://github.com/oe/sourcetree-alfred-workflow

 

 

Credits: This is a swift clone of Alfred_SourceTree by yourtion. Due to the latest release of macOS 12.3, python2 has been removed, which broke the original workflow. So I reimplemented this workflow in Swift. It should be much more stable and faster.

 

usage-demo.gif

 

 

Screenshot 2022-12-30 at 21.55.16.png

Edited by Saiya
Link to comment
Share on other sites

22 hours ago, vitor said:

This is using Workflow Environment Variables instead of Workflow Configuration and there’s no backgroundless screenshot with shadow. Please see the pinned post for submission requirements.


Happy holidays.

Thanks for your correction, I've released a new version that support Workflow Configuration, along with a new backgroundless screenshot 

 

Link to comment
Share on other sites

While testing found other small issues. Specifically, the detection of SourceTree isn’t accurate if the app is installed but no repos have been added. In that case the workflow says SourceTree isn’t yet installed, which will be confusing. It would be more accurate to show no repos have been added.

 

It should do no harm to simply remove the check if you don’t have a better alternative, because app dependencies are listed and linked to in the Gallery (as an example see Moom, right before Usage). Plus, the name and functionality of the workflow make it fairly obvious.

 

You also have a deprecation warning.

 

workflow.swift:42:12: warning: 'init(cString:encoding:)' is deprecated: Use String(_ scalar: Unicode.Scalar)
    return String(cString: &sysInfo.machine.0, encoding: .utf8) == "arm64"
           ^

 

Finally, while I do get your point in offering to compile the script, at least for now lets avoid it. After the first run, subsequent runs should go faster anyway even when calling it as a script.

Link to comment
Share on other sites

47 minutes ago, vitor said:

While testing found other small issues. Specifically, the detection of SourceTree isn’t accurate if the app is installed but no repos have been added. In that case the workflow says SourceTree isn’t yet installed, which will be confusing. It would be more accurate to show no repos have been added.

 

It should do no harm to simply remove the check if you don’t have a better alternative, because app dependencies are listed and linked to in the Gallery (as an example see Moom, right before Usage). Plus, the name and functionality of the workflow make it fairly obvious.

 

You also have a deprecation warning.

 

workflow.swift:42:12: warning: 'init(cString:encoding:)' is deprecated: Use String(_ scalar: Unicode.Scalar)
    return String(cString: &sysInfo.machine.0, encoding: .utf8) == "arm64"
           ^

 

Finally, while I do get your point in offering to compile the script, at least for now lets avoid it. After the first run, subsequent runs should go faster anyway even when calling it as a script.

1. the confusing message only show up when you have SourceTree installed but never launched it, so the bookmarks configuration files won't be created. I'll try a better approach to do the check 

2. the warning does not affect its function, I will do more research to get rid of it

3. I would insist on compiling the script, Swift JIT is now much slower on macOS Ventura, even on M1 machines,  and much worse on Intel macs

 

Link to comment
Share on other sites

1 hour ago, Saiya said:

the confusing message only show up when you have SourceTree installed but never launched it

 

Nope, I had it launched and it was still telling me it was not installed. Only once I added a repo was it fixed.

 

1 hour ago, Saiya said:

I would insist on compiling the script

 

You’re also compiling the script into the workflow’s directory itself, meaning it will be deleted every time there’s an update and require recompilation. If you remove that option the workflow can be added soon and we can then work on a better solution. Otherwise it’ll take a bit longer to consider since we’d like to avoid those kinds of operations.

Link to comment
Share on other sites

22 hours ago, vitor said:

 

Nope, I had it launched and it was still telling me it was not installed. Only once I added a repo was it fixed.

 

 

You’re also compiling the script into the workflow’s directory itself, meaning it will be deleted every time there’s an update and require recompilation. If you remove that option the workflow can be added soon and we can then work on a better solution. Otherwise it’ll take a bit longer to consider since we’d like to avoid those kinds of operations.

 

OK, the `compile` option has been removed.

 

 

On 12/27/2022 at 10:55 PM, Saiya said:

1. the confusing message only show up when you have SourceTree installed but never launched it, so the bookmarks configuration files won't be created. I'll try a better approach to do the check 

2. the warning does not affect its function, I will do more research to get rid of it

3. I would insist on compiling the script, Swift JIT is now much slower on macOS Ventura, even on M1 machines,  and much worse on Intel macs

 

issue 2, the code  has been commented out;  issue 1 needs further researching

Link to comment
Share on other sites

On 12/27/2022 at 10:55 PM, Saiya said:

1. the confusing message only show up when you have SourceTree installed but never launched it, so the bookmarks configuration files won't be created. I'll try a better approach to do the check 

2. the warning does not affect its function, I will do more research to get rid of it

3. I would insist on compiling the script, Swift JIT is now much slower on macOS Ventura, even on M1 machines,  and much worse on Intel macs

 

issue 1 has been fixed, the icon of this workflow has been updated too

Link to comment
Share on other sites

On 1/7/2023 at 1:50 AM, vitor said:

Thank you for the changes, this will be live soon. Have you noticed that you have both workflow and workflow.swift, which are duplicates of each other?

Yes, I just leave a hidden way to compile script in case of any one complain about the performance issue

Link to comment
Share on other sites

22 hours ago, vitor said:

I noticed that, but you shouldn’t need both files since they are identical, you can compile and run either.

It's the simplest way with a little cost to make the compiling procedure reproducible.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...