Coder Social home page Coder Social logo

approle.swift's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.