Skip to content

philocalyst / **infat ** Public

一个命令行工具,用于在 macOS 上设置文件格式和 URL schemes 的默认打开方式

License

MIT license 54 stars 1 fork Branches Tags Activity Star Notifications You must be signed in to change notification settings

Additional navigation options

philocalyst/infat

main BranchesTags Go to file Code

Folders and files

Name| Name| Last commit message| Last commit date ---|---|---|---

Latest commit

History

90 Commits .github/workflows| .github/workflows Completions| Completions Sources| Sources .gitignore| .gitignore CHANGELOG.md| CHANGELOG.md LICENSE| LICENSE Package.swift| Package.swift README.md| README.md justfile| justfile View all files

Repository files navigation

Welcome to Infat

Swift Version Apple Platform

Infat 是一个超强大的、macOS 原生的 CLI 工具,用于声明式地管理文件类型和 URL scheme 的关联。 避免导航子菜单来设置默认浏览器或图像查看器的麻烦,以及每次获得新机器时都要执行此操作的痛苦。设置一次规则,并沉浸在您自己的聪明才智中,直到永远。夺回控制权,并将您的打开器绑定到您想要的任何东西。覆盖一切!谁会阻止你?

Summary

Get Started

首先安装 Infat — 跳转到下面的 Install 部分。

Tutorial

1. Listing Associations

# 显示 .txt 文件的默认应用程序
infat list txt
# 显示 .txt 文件的所有注册应用程序
infat list --assigned txt

2. Setting a Default Application

# 对 .md 文件使用 TextEdit
infat set TextEdit --file-type md
# 对 .json 文件使用 VSCode
infat set VSCode --file-type json

3. Binding a URL Scheme

# 对 mailto: 链接使用 Mail.app
infat set Mail --scheme mailto

4. Configuration

将 TOML 文件放置在 $XDG_CONFIG_HOME/infat/config.toml (或传递 --config path/to/config.toml),其中包含两个表:

[files]
md  = "TextEdit"
html = "Safari"
pdf  = "Preview"

[schemes]
mailto = "Mail"
web  = "Safari"

不带参数运行以应用所有条目。

infat --config ~/.config/infat/config.toml

Design Philosophy

Building and Debugging

您需要 just 和 Swift 5.9+:

# Debug build
just build
# Release build
just build-release
# Run in debug mode
just run "list txt"
# Enable verbose logging for troubleshooting
infat --verbose list pdf

Install

Homebrew

brew install philocalyst/tap/infat

From Source

git clone https://github.com/philocalyst/infat.git && cd infat
just package && mv dist/infat* /usr/local/bin/infat # Wildcard because output name includes platform

Changelog

有关更改的完整历史记录,请参见 CHANGELOG.md

Libraries Used

Acknowledgements

License

Infat is licensed under the MIT License. Feel free to use, modify, and distribute!

About

A command line tool to set default openers for file formats and url schemes on macos

Resources

Readme

License

MIT license Activity

Stars

54 stars

Watchers

2 watching

Forks

1 fork Report repository

Releases 6

v1.0.0 Latest Apr 24, 2025 + 5 releases

Packages 0

No packages published

Contributors 2

Languages

Footer

© 2025 GitHub, Inc.

Footer navigation

You can’t perform that action at this time.