approle

master

🖇 CLI to set defalut application for UTIs and Extensions
aerobounce/approle.swift

approle.swift

CLI to associate UTI and Extension to an application.
Stand alone executable Swift program.

Install

brew install aerobounce/tap/approle

Usage

Print bundle identifier for an Application Name.

approle id <Application Name>

Print UTIs associated to Extensions.

approle uti <Extension>...

Print filtered list of UTIs declared in system.

approle list [Conforming UTI...] [!Non-Conforming UTI...]

Print UTI tree of Object Path.

approle tree <Object Path>

Set an identifier to UTIs / Extensions as default role handler (All Roles).

approle set <(Application Name | Bundle Identifier)> <(UTI | Extension)>...

Show help.

approle help

Examples

Get BundleIdentifier of an Application

> approle id TextEdit
com.apple.TextEdit
> approle id Xcode
com.apple.dt.Xcode

Get UTIs from extensions

> approle uti sh py rb
public.shell-script # .sh
public.python-script # .py
public.ruby-script # .rb

List all UTIs matching

# List all UTIs which conform to `public.archive` excluding UTIs conform to `public.disk-image`.
> approle list "public.archive" "!public.disk-image"
com.winzip.zipx-archive
org.tukaani.lzma-archive
public.lzip-archive
public.lzip-tar-archive
public.lzop-archive
public.lzop-tar-archive
public.lrzip-archive
public.lrzip-tar-archive
...

Print UTI tree of an object

> approle tree ./example.txt
public.plain-text
public.text
public.data
public.item
public.content
> approle tree ./example.md
net.daringfireball.markdown
public.plain-text
public.text
public.data
public.item
public.content

Set default application for UTI / Extension

> approle set Xcode sh public.python-script rb
Succeeded: com.apple.dt.Xcode -> public.shell-script (.sh)
Succeeded: com.apple.dt.Xcode -> public.python-script
Succeeded: com.apple.dt.Xcode -> public.ruby-script (.rb)

Read from stdin

approle set Xcode << EOF
c h hh m mm
swift
EOF
Succeeded: com.apple.dt.Xcode -> public.c-source (.c)
Succeeded: com.apple.dt.Xcode -> public.c-header (.h)
Succeeded: com.apple.dt.Xcode -> public.c-plus-plus-header (.hh)
Succeeded: com.apple.dt.Xcode -> public.objective-c-source (.m)
Succeeded: com.apple.dt.Xcode -> public.objective-c-plus-plus-source (.mm)
Succeeded: com.apple.dt.Xcode -> public.swift-source (.swift)

Use UTI list to set default application

# Set Xcode as default application for all the UTIs conform to `public.source-code`.
approle list "public.source-code" | approle set Xcode

Use UTI tree to set default application

# Better to skip too generic UTIs.
approle tree ./example.md |
    grep -v -E 'public.(item|folder|directory|data|content)' |
    approle set Xcode

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 18 2024 09:46:45 GMT-0900 (Hawaii-Aleutian Daylight Time)