LinguistMap is a powerful CLI tool that generates JSON mappings of programming languages and their file extensions based on GitHub's Linguist YAML file.
- Fetches the latest language data from GitHub's Linguist repository
- Falls back to an embedded YAML file if network fetch fails
- Generates simple extension-to-language and language-to-extension mappings by default
- Optionally creates detailed language maps with additional metadata in both directions
- Embedded YAML file ensures the tool always works, even offline
- Ensure you have Go installed on your system.
- Clone this repository:
git clone https://github.com/gusanmaz/LinguistMap.git cd LinguistMap
- Build the program:
go build -o linguistmap main.go
To generate simple mapping files:
./linguistmap
This will create two JSON files:
extension_to_language.json
: Maps file extensions to languageslanguage_to_extension.json
: Maps languages to file extensions
To generate detailed language maps with additional metadata:
./linguistmap -d
or
./linguistmap --detailed
This will create two JSON files:
detailed_extension_to_language.json
: Maps file extensions to detailed language informationdetailed_language_to_extension.json
: Maps languages to their detailed information, including extensions and filenames
Usage of ./linguistmap:
-d, --detailed Generate detailed language maps
extension_to_language.json
: Maps extensions to languages (simple mode)language_to_extension.json
: Maps languages to extensions (simple mode)detailed_extension_to_language.json
: Maps extensions to detailed language information (detailed mode)detailed_language_to_extension.json
: Maps languages to their detailed information (detailed mode)
If the program fails to fetch the YAML file from GitHub, it will automatically use the embedded YAML file included in the binary. This ensures the tool always works, even without an internet connection.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Created and maintained by gusanmaz.
- GitHub Repository: https://github.com/gusanmaz/LinguistMap
- Issues: https://github.com/gusanmaz/LinguistMap/issues
This tool is based on the language data provided by GitHub Linguist.git