Skip to content

Commit

Permalink
new backup
Browse files Browse the repository at this point in the history
  • Loading branch information
rknightuk committed Oct 10, 2023
1 parent 70d879d commit e1aacd1
Show file tree
Hide file tree
Showing 97 changed files with 877 additions and 515 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
68 changes: 14 additions & 54 deletions api.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"description": "Open commonly used folders",
"version": "1.0.0",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/common-folders",
"screenshot": null,
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/common-folders/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/common-folders/src/icon.png"
},
{
Expand All @@ -60,7 +60,7 @@
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/fathom-analytics/src/icon.png"
},
{
"uid": "24FCC94B-C25A-472C-948A-7ECBE05A05C4",
"uid": "53825314-ED2B-4459-A815-30FD4A0CEAD8",
"bundleid": "folder-actions",
"name": "File Actions",
"description": "Open folders and files in an editor, Finder, or Terminal",
Expand All @@ -69,16 +69,6 @@
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/folder-actions/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/folder-actions/src/icon.png"
},
{
"uid": "D20D883A-93E9-4AC5-8ECA-94CA8C24212B",
"bundleid": "finder-to-terminal",
"name": "Finder to Terminal",
"description": "Open the current finder window in Terminal",
"version": "1.0.0",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/finder-to-terminal",
"screenshot": null,
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/finder-to-terminal/src/icon.png"
},
{
"uid": "63C97432-3FEE-41E6-9E71-341D2847B511",
"bundleid": "findmoji",
Expand All @@ -103,12 +93,22 @@
"uid": "91A22320-A0A4-4975-84EB-8CAE87983322",
"bundleid": "gifsearch",
"name": "Gif Search",
"description": "Gif Search",
"description": "Search a folder of gifs and copy them to the clipboard",
"version": "1.0.0",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/gifsearch",
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/gifsearch/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/gifsearch/src/icon.png"
},
{
"uid": "4F5F0471-0DD5-40E3-87D9-097CABD37FF9",
"bundleid": "honk",
"name": "Honk",
"description": "honk honk",
"version": "1.0.0",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/honk",
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/honk/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/honk/src/icon.png"
},
{
"uid": "2843DBB7-8C9B-467F-A34C-95D6FA3795DE",
"bundleid": "hotkey-list",
Expand Down Expand Up @@ -139,16 +139,6 @@
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/intersect/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/intersect/src/icon.png"
},
{
"uid": "60F26FA1-5C8E-4D17-B006-4672924033F4",
"bundleid": "jump-list",
"name": "Jump List",
"description": "ZSH Jump list plugin in Alfred",
"version": "1.0.0",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/jump-list",
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/jump-list/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/jump-list/src/icon.png"
},
{
"uid": "55F2C350-099A-46F7-8EB4-0A0B3417380D",
"bundleid": "micromarks",
Expand Down Expand Up @@ -179,16 +169,6 @@
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/monzo-link-generator/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/monzo-link-generator/src/icon.png"
},
{
"uid": "820FA10D-DFD8-4198-A933-57842F0DD8C0",
"bundleid": "networktools",
"name": "Network Tools",
"description": "Network tools",
"version": "1.0.0",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/networktools",
"screenshot": null,
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/networktools/src/icon.png"
},
{
"uid": "8C883807-9A97-47F9-8462-6F6D60A2DCBD",
"bundleid": "new-file-in-finder",
Expand All @@ -199,16 +179,6 @@
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/new-file-in-finder/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/new-file-in-finder/src/icon.png"
},
{
"uid": "C0EBCE37-F304-4643-91B2-56CDA5919D37",
"bundleid": "projects-dev",
"name": "Project Development",
"description": "Open a projects folder in an editor, Finder, or Terminal",
"version": "1.0.0",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/projects-dev",
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/projects-dev/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/projects-dev/src/icon.png"
},
{
"uid": "771E53C4-B7A2-4155-85BD-9330E555F091",
"bundleid": "shortcuts",
Expand Down Expand Up @@ -283,22 +253,12 @@
"uid": "E9117578-5A32-4247-8F4B-D494C3932310",
"bundleid": "treatday",
"name": "Treat Day",
"description": "Saturday is Treat Day",
"description": "Brian Butterfield Sound Clips",
"version": "1.0.1",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/treatday",
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/treatday/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/treatday/src/icon.png"
},
{
"uid": "DAE08003-3D07-40EA-8C22-6475BDE95074",
"bundleid": "twitter-archive-search",
"name": "Twitter Archive Search",
"description": "Search your local Twitter archive",
"version": "1.0.1",
"link": "https://github.com/rknightuk/alfred-workflows/blob/main/workflows/twitter-archive-search",
"screenshot": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/twitter-archive-search/src/screenshot.png",
"icon": "https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/twitter-archive-search/src/icon.png"
},
{
"uid": "8ED99597-6655-4CDA-B54C-455F9A1AE3DE",
"bundleid": "url-schemes",
Expand Down
68 changes: 46 additions & 22 deletions backup.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
// The directory to backup your workflows
const BACKUP_PATH="/Users/robb/Developer/archive/alfred-workflows"
const BACKUP_PATH="/Users/robb/Developer/personal/alfred-workflows"

//The directory where your Alfred workflows live
const WORKFLOW_PATH="/Users/robb/Dropbox/Alfred/Alfred.alfredpreferences/workflows"

//The bundle prefix you use for your workflows
const BUNDLE_PREFIX="com.rknightuk."

//The Github repository
// The Github repository
const GITHUB_REPO="rknightuk/alfred-workflows"
const GITHUB_DOWNLOAD="https://github.com/${GITHUB_REPO}/raw/main"

//Copy the example readme into the backup readme file
// Copy the example readme into the backup readme file
const README_FILE=`${BACKUP_PATH}/readme.md`

const FORKED = {
'com.fniephaus.pocket': 'https://github.com/rknightuk/alfred-pocket',
}

function run(argv) {

// todo run for one workflow
const singleWorkflow = argv[0]
const singleWorkflow = argv

const app = Application.currentApplication();
app.includeStandardAdditions = true;
Expand All @@ -40,36 +36,70 @@ function run(argv) {
try {
data = se.propertyListFiles.byName(`${WORKFLOW_PATH}/${wf}/info.plist`).contents.value()
} catch (e) {
// no idea something changed
console.log(`Cannot run for ${wf}`)
return
}

if (!data) return

let { disabled, webaddress, createdby, version, bundleid, description, name, variables, variablesdontexport } = data
if (disabled) return null
let { disabled, webaddress, createdby, version, bundleid, description, name, variables, variablesdontexport, objects } = data
if (disabled) return
if (!version) version = '1.0.0'
const isMine = bundleid.includes(BUNDLE_PREFIX)
bundleid = bundleid.replace(BUNDLE_PREFIX, '')
if (!bundleid) return;
if (!bundleid) return

if (isMine) {
let currentWorkflow=`${WORKFLOW_PATH}/${wf}`
formattedDescription = description ? `_${description.trim()}_ ` : null

if (variables && variablesdontexport && variablesdontexport.length > 0)
{
currentWorkflow = app.doShellScript(`./overridevariables.sh ${currentWorkflow}`);
currentWorkflow = app.doShellScript(`./overridevariables.sh ${currentWorkflow}`)
}

let hasReadme = app.doShellScript(`[ -f ${currentWorkflow}/readme.md ] && echo "true" || echo "false"`) === 'true'
const hasScreenshot = app.doShellScript(`[ -f ${currentWorkflow}/screenshot.png ] && echo "true" || echo "false"`) === 'true'
const hasChangelog = app.doShellScript(`[ -f ${currentWorkflow}/changelog.md ] && echo "true" || echo "false"`) === 'true'

if (!hasReadme) {
let keyword = null
objects.every(o => {
if (o.config.keyword)
{
keyword = o.config.keyword
return false
}
return true
})
let contents = app.read(Path(`${BACKUP_PATH}/workflow-readme.example`))
contents = contents.replaceAll('{{ NAME }}', name)
.replaceAll('{{ DESC }}', description)
.replaceAll('{{ KEYWORD }}', keyword)

if (name === 'Workflow Development')
{
console.log(contents)
console.log(keyword)
}

app.doShellScript(`touch ${currentWorkflow}/readme.md`)
let newReadmeFile = app.openForAccess(Path(`${currentWorkflow}/readme.md`), { writePermission: true })
app.setEof(newReadmeFile, { to: 0 })
app.write(contents, { to: newReadmeFile, startingAt: app.getEof(newReadmeFile) })
app.closeAccess(newReadmeFile)

console.log(`Added readme for ${name}`)
hasReadme = true
}

const copyPath=`${BACKUP_PATH}/workflows/${bundleid}/${bundleid}.alfredworkflow`
const link = `workflows/${bundleid}`
app.doShellScript(`mkdir -p ${BACKUP_PATH}/workflows/${bundleid}/src/`)
app.doShellScript(`cp -r ${currentWorkflow}/ ${BACKUP_PATH}/workflows/${bundleid}/src/`)
app.doShellScript(`ditto -ck "${currentWorkflow}" "${copyPath}"`)

const hasReadme = app.doShellScript(`[ -f ${BACKUP_PATH}/workflows/${bundleid}/src/readme.md ] && echo "true" || echo "false"`) === 'true'
const hasScreenshot = app.doShellScript(`[ -f ${BACKUP_PATH}/workflows/${bundleid}/src/screenshot.png ] && echo "true" || echo "false"`) === 'true'
const hasChangelog = app.doShellScript(`[ -f ${BACKUP_PATH}/workflows/${bundleid}/src/changelog.md ] && echo "true" || echo "false"`) === 'true'
if (!hasScreenshot) console.log(`⚠️ No screenshot found for ${name}`)

if (hasReadme)
{
Expand Down Expand Up @@ -112,14 +142,11 @@ function run(argv) {

apiData.push(wfData)
} else {
return
const isForked = Object.keys(FORKED).includes(bundleid)
if (createdby) {
others.push({
name,
author: createdby,
link: webaddress,
fork: isForked ? FORKED[bundleid] : null,
})
}
}
Expand Down Expand Up @@ -149,9 +176,6 @@ function run(argv) {
if (o.link) {
text = `- [${o.name} by ${o.author}](${o.link})`
}
if (o.fork) {
text += ` [[My Fork](${o.fork})]`
}

app.doShellScript(`echo "${text}" >> ${README_FILE}`);
})
Expand Down
1 change: 1 addition & 0 deletions readme.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The theme in the screenshots is [Tempo Alternative (Dark)](https://github.com/ch
- Looping through all workflows in my Alfred workflow directory
- If it has my bundle ID in the plist file, it extracts the metadata using `PListBuddy`, adds it to the first list below, then zips the workflow as an `.alfredworkflow`
- If it doesn't have my bundle ID, then it gets the name, author and website and puts them in the second list below
- Adds readmes to workflows that don't have them and warns on missing screenshots

See the comments in the script to set this up for your own workflows

Expand Down
49 changes: 18 additions & 31 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ _Send clipboard contents to carbon.now.sh to generate an image_ [Download v1.0.0

_Open commonly used folders_ [Download v1.0.0](workflows/common-folders)

![common-folders screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/common-folders/src/screenshot.png)

### Fathom Analytics

_View current visitors for your sites_ [Download v1.0.2](workflows/fathom-analytics)
Expand All @@ -69,10 +71,6 @@ _Open folders and files in an editor, Finder, or Terminal_ [Download v1.0.0](wor
- [2021-07-23] Now shows options to option in Finder, Sublime, Terminal, or All


### Finder to Terminal

_Open the current finder window in Terminal_ [Download v1.0.0](workflows/finder-to-terminal)

### Findmoji

_Find and paste emoji_ [Download v1.0.1](workflows/findmoji)
Expand All @@ -87,10 +85,16 @@ _Copy all current Safari tabs to Markdown_ [Download v1.2.2](workflows/safari-ta

### Gif Search

_Gif Search_ [Download v1.0.0](workflows/gifsearch)
_Search a folder of gifs and copy them to the clipboard_ [Download v1.0.0](workflows/gifsearch)

![gifsearch screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/gifsearch/src/screenshot.png)

### Honk

_honk honk_ [Download v1.0.0](workflows/honk)

![honk screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/honk/src/screenshot.png)

### Hotkey List

_List all workflows assigned to a hotkey_ [Download v1.0.2](workflows/hotkey-list)
Expand All @@ -113,12 +117,6 @@ _Workflow for searching the Intersect_ [Download v1.0.0](workflows/intersect)

![intersect screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/intersect/src/screenshot.png)

### Jump List

_ZSH Jump list plugin in Alfred_ [Download v1.0.0](workflows/jump-list)

![jump-list screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/jump-list/src/screenshot.png)

### MicroMarks

_Manage your micro.blog bookmarks_ [Download v1.0.0](workflows/micromarks)
Expand All @@ -137,25 +135,12 @@ _Generate Monzo.me Link_ [Download v1.0.0](workflows/monzo-link-generator)

![monzo-link-generator screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/monzo-link-generator/src/screenshot.png)

### Network Tools

_Network tools_ [Download v1.0.0](workflows/networktools)

### New File in Finder

_Create a new file in the current Finder window_ [Download v1.0.0](workflows/new-file-in-finder)

![new-file-in-finder screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/new-file-in-finder/src/screenshot.png)

### Project Development

_Open a projects folder in an editor, Finder, or Terminal_ [Download v1.0.0](workflows/projects-dev)

![projects-dev screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/projects-dev/src/screenshot.png)

- [2021-07-23] Now shows options to option in Finder, Sublime, Terminal, or All


### Shortcuts

_Run Shortcuts_ [Download v1.0.0](workflows/shortcuts)
Expand Down Expand Up @@ -200,16 +185,10 @@ _Removes tracking parameters from links_ [Download v1.0.0](workflows/trackerzapp

### Treat Day

_Saturday is Treat Day_ [Download v1.0.1](workflows/treatday)
_Brian Butterfield Sound Clips_ [Download v1.0.1](workflows/treatday)

![treatday screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/treatday/src/screenshot.png)

### Twitter Archive Search

_Search your local Twitter archive_ [Download v1.0.1](workflows/twitter-archive-search)

![twitter-archive-search screenshot](https://raw.githubusercontent.com/rknightuk/alfred-workflows/main/workflows/twitter-archive-search/src/screenshot.png)

### URL Schemes

_Show all URL schemes for installed apps_ [Download v1.0.0](workflows/url-schemes)
Expand All @@ -227,3 +206,11 @@ _Open a workflow's files in an editor, Finder, or Terminal_ [Download v1.1.0](wo

## Third Party Workflows

- [Datetime Format Converter by Michael Waterfall](twitter.com/mwaterfall)
- [IP Address v1.2.0 by David Ferguson](jdfwarrior.tumblr.com)
- [Lorem Ipsum by Till Krüss](https://till.im)
- [Play Song by Caleb Evans](https://github.com/caleb531/play-song)
- [Search Notes by Sean Ballinger](https://github.com/sballin/alfred-search-notes-app)
- [SoulverCore by Carlos Precioso](https://precioso.design/)
- [System Settings by Vítor Galvão](https://github.com/alfredapp/system-settings-workflow/)
- [Temp Conversion by Justin Hamilton](https://www.jwhamilton.co)
Loading

0 comments on commit e1aacd1

Please sign in to comment.