Skip to content

Commit

Permalink
Switch to use Alfred configuration instead of env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
bjrnt committed Jan 16, 2024
1 parent 45f393d commit 8654664
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 40 deletions.
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

## Installation

1. Grab the latest release [here](https://github.com/bjrnt/alfred-project-manager/releases/) and install the workflow file.
2. Set the `PROJECT_DIRECTORY` path inside the workflow's environment variables (select the workflow and press the `[x]` icon in the upper right). A relative path is assumed to be relative to your home directory.
- Grab the latest release [here](https://github.com/bjrnt/alfred-project-manager/releases/) and install the workflow file.

## Usage

Expand All @@ -22,17 +21,10 @@ Open Alfred and type `pm` to access the project manager and try typing a query.

You can change the modifier and application combinations in Alfred's workflow settings window.

### Further Config
### Features

#### Show Only Git Repos

If you only want the workflow to show valid Git repos, you can set the `REQUIRE_DOTGIT` to `true` in the workflow's environment variables.

#### Workspaced Projects

You can configure the workflow `MAX_PROJECT_DEPTH` to an integer larger than zero if you have nested or workspaced projects. For example, if you have different folders for different companies or clients where you have your projects, you would set this to 1.

It is recommended you combine this option with only showing git repos to avoid false positives.
- Enable "Show only valid Git repos" if you want to exclude folders in your project directory that are not Git repos.
- Increase "Maximum Project Depth" if your projects are grouped within other folders in your projects directory. For example, if my "projects" folder has folders "personal" and "work" and both of these contain my projects, I'd set the value to 1.

## Maintenance

Expand Down
Binary file added alfred-project-manager-1.5.0.alfredworkflow
Binary file not shown.
8 changes: 4 additions & 4 deletions params.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
)

const (
projectDirEnvVar = "PROJECT_DIRECTORY"
reqDotGitEnvVar = "REQUIRE_DOTGIT"
maxProjDepthEnvVar = "MAX_PROJECT_DEPTH"
projectDirEnvVar = "ProjectDirectory"
reqDotGitEnvVar = "RequireDotGit"
maxProjDepthEnvVar = "MaxProjectDepth"
maxResults = 5
)

Expand All @@ -24,7 +24,7 @@ type Params struct {
func NewParamsFromEnv() (*Params, error) {
projDir := os.Getenv(projectDirEnvVar)
if len(projDir) == 0 {
return nil, fmt.Errorf("Please set %s before using the workflow", projectDirEnvVar)
return nil, fmt.Errorf("Please set project directory before using the workflow")
}

reqDotGit, err := strconv.ParseBool(os.Getenv(reqDotGitEnvVar))
Expand Down
Binary file modified workflow/alfred-project-manager
Binary file not shown.
105 changes: 81 additions & 24 deletions workflow/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@
<dict>
<key>browser</key>
<string></string>
<key>skipqueryencode</key>
<false/>
<key>skipvarencode</key>
<false/>
<key>spaces</key>
<string></string>
<key>url</key>
<string>{var:url}</string>
<key>utf8</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.openurl</string>
Expand Down Expand Up @@ -227,57 +229,112 @@
<key>6D608B30-5502-43EE-919B-DF50AFCF905A</key>
<dict>
<key>xpos</key>
<integer>560</integer>
<real>560</real>
<key>ypos</key>
<integer>230</integer>
<real>230</real>
</dict>
<key>7E5DA35F-1364-4EA4-A547-9C7845EF6BEC</key>
<dict>
<key>xpos</key>
<integer>430</integer>
<real>430</real>
<key>ypos</key>
<integer>10</integer>
<real>15</real>
</dict>
<key>80C9A89F-7B23-49D6-A60E-EB052C35FEE4</key>
<dict>
<key>xpos</key>
<integer>560</integer>
<real>560</real>
<key>ypos</key>
<integer>90</integer>
<real>90</real>
</dict>
<key>94F8A8DC-9518-4612-8C64-3736BA9BC9D7</key>
<dict>
<key>xpos</key>
<integer>305</integer>
<real>305</real>
<key>ypos</key>
<integer>230</integer>
<real>230</real>
</dict>
<key>BE1B8E2A-733A-447E-8EF1-314DFD00E7F1</key>
<dict>
<key>xpos</key>
<integer>560</integer>
<real>560</real>
<key>ypos</key>
<integer>370</integer>
<real>370</real>
</dict>
<key>FBC8069B-1615-4CD3-BA60-146A434156A1</key>
<dict>
<key>xpos</key>
<integer>300</integer>
<real>300</real>
<key>ypos</key>
<integer>430</integer>
<real>430</real>
</dict>
</dict>
<key>variables</key>
<dict>
<key>MAX_PROJECT_DEPTH</key>
<string>0</string>
<key>PROJECT_DIRECTORY</key>
<string></string>
<key>REQUIRE_DOTGIT</key>
<string>false</string>
</dict>
<key>userconfigurationconfig</key>
<array>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>filtermode</key>
<integer>1</integer>
<key>placeholder</key>
<string></string>
<key>required</key>
<true/>
</dict>
<key>description</key>
<string>The directory containing your projects</string>
<key>label</key>
<string>Project Directory</string>
<key>type</key>
<string>filepicker</string>
<key>variable</key>
<string>ProjectDirectory</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<false/>
<key>required</key>
<false/>
<key>text</key>
<string>Require Git Repo</string>
</dict>
<key>description</key>
<string>Enable this to hide folders in your project directory that are not valid git repos</string>
<key>label</key>
<string>Show only valid Git repos</string>
<key>type</key>
<string>checkbox</string>
<key>variable</key>
<string>RequireDotGit</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string>0</string>
<key>placeholder</key>
<string></string>
<key>required</key>
<true/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string>This controls how many folders "deep" the workflow will look for your projects within your projects folder. For example, set this to 1 if you have grouped projects in other folders within your project directory.</string>
<key>label</key>
<string>Maximum Project Depth</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>MaxProjectDepth</string>
</dict>
</array>
<key>version</key>
<string>1.4.0</string>
<string>1.5.0</string>
<key>webaddress</key>
<string>https://www.github.com/bjrnt</string>
</dict>
Expand Down

0 comments on commit 8654664

Please sign in to comment.