Git Product home page Git Product logo

uti-convert's Introduction

uti-convert

Convert file extension or MIME type to UTI(Uniform Type Identifiers) and vice versa.

Installation

  1. Clone or download the source code from this repository
  2. cd the source code directory
  3. do make install command

Generate shell completion script

For fish

uti-convert --generate-completion-script > ~/.config/fish/completions/uti-convert.fish

For zsh

uti-convert --generate-completion-script > ~/.oh-my-zsh/completions/_uti-convert # or other completion script file/directory

For bash

uti-convert --generate-completion-script >> ~/.bashrc # or other completion script file/directory

Note: This command will detect current shell automatically, or you can specify one with: uti-convert --generate-completion-script [fish|zsh|bash] > /path/to/completion/file

Usage

uti-convert [--full] [--from-type <from-type>] <tags> ...

ARGUMENTS:
  <tags>                  type list

OPTIONS:
  --full                  Show full information
  --without-tree          Without UTI tree information
  -f, --from-type <from-type>
                          Which type should convert, the available types are:
                              - file: get file extension automatically from file
                              - extension: file extension, e.g. swift
                              - mime: MIME type, e.g. png
                              - uti: show MIME types and file extensions for specified UTI
                              - auto: detect extension or mime type automatically (default: auto)
  -h, --help              Show help information.

Show UTIs with auto-detection

> uti-convert jpg  gif
# output
jpg -> public.jpeg
gif -> com.compuserve.gif, com.apple.private.auto-loop-gif

> uti-convert image/jpg image/gif
# output
image/jpg -> public.jpeg
image/gif -> com.compuserve.gif, com.apple.private.auto-loop-gif


> uti-convert --full jpg gif
# output
jpg:
----
UTIs: public.jpeg
MIME types: image/jpeg, image/jpg
File extensions: jpeg, jpg, jpe
UTI Tree:
╭────────╯
╰── public.jpeg
   ├── public.content
   ├── public.data
   │  ╰── public.item
   ├── public.image
   │  ├── public.content
   │  ├── public.data
   │  │  ╰── public.item
   │  ╰── public.item
   ╰── public.item

gif:
----
UTIs: com.compuserve.gif, com.apple.private.auto-loop-gif
MIME types: image/gif
File extensions: gif
UTI Tree:
╭────────╯
├── com.compuserve.gif
│  ├── public.content
│  ├── public.data
│  │  ╰── public.item
│  ├── public.image
│  │  ├── public.content
│  │  ├── public.data
│  │  │  ╰── public.item
│  │  ╰── public.item
│  ╰── public.item
╰── com.apple.private.auto-loop-gif

> uti-convert --full image/jpg image/gif
# output
jpg:
----
UTIs: public.jpeg
MIME types: image/jpeg, image/jpg
File extensions: jpeg, jpg, jpe
UTI Tree:
╭────────╯
╰── public.jpeg
   ├── public.content
   ├── public.data
   │  ╰── public.item
   ├── public.image
   │  ├── public.content
   │  ├── public.data
   │  │  ╰── public.item
   │  ╰── public.item
   ╰── public.item

gif:
----
UTIs: com.compuserve.gif, com.apple.private.auto-loop-gif
MIME types: image/gif
File extensions: gif
UTI Tree:
╭────────╯
├── com.compuserve.gif
│  ├── public.content
│  ├── public.data
│  │  ╰── public.item
│  ├── public.image
│  │  ├── public.content
│  │  ├── public.data
│  │  │  ╰── public.item
│  │  ╰── public.item
│  ╰── public.item
╰── com.apple.private.auto-loop-gif

Convert file extension to UITs

> uti-convert -f extension jpg
# output
jpg -> public.jpeg


> uti-convert --full -f extension jpg
# output
jpg:
----
UTIs: public.jpeg
MIME types: image/jpeg, image/jpg
File extensions: jpeg, jpg, jpe
UTI Tree:
╭────────╯
╰── public.jpeg
   ├── public.content
   ├── public.data
   │  ╰── public.item
   ├── public.image
   │  ├── public.content
   │  ├── public.data
   │  │  ╰── public.item
   │  ╰── public.item
   ╰── public.item

Convert file to UITs

> uti-convert -f file somefile.jpg
# output
somefile.jpg -> public.jpeg


> uti-convert --full -f file somefile.jpg
# output
somefile.jpg:
-------------
UTIs: public.jpeg
MIME types: image/jpeg, image/jpg
File extensions: jpeg, jpg, jpe
UTI Tree:
╭────────╯
╰── public.jpeg
   ├── public.content
   ├── public.data
   │  ╰── public.item
   ├── public.image
   │  ├── public.content
   │  ├── public.data
   │  │  ╰── public.item
   │  ╰── public.item
   ╰── public.item

Show information for any UTIs

> uti-convert -f uti public.jpeg public.png
# output
public.jpeg:
------------
UTIs: public.jpeg
MIME types: image/jpeg, image/jpg
File extensions: jpeg, jpg, jpe
UTI Tree:
╭────────╯
╰── public.jpeg
   ├── public.content
   ├── public.data
   │  ╰── public.item
   ├── public.image
   │  ├── public.content
   │  ├── public.data
   │  │  ╰── public.item
   │  ╰── public.item
   ╰── public.item

public.png:
-----------
UTIs: public.png
MIME types: image/png
File extensions: png
UTI Tree:
╭────────╯
╰── public.png
   ├── public.content
   ├── public.data
   │  ╰── public.item
   ├── public.image
   │  ├── public.content
   │  ├── public.data
   │  │  ╰── public.item
   │  ╰── public.item
   ╰── public.item

uti-convert's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.