1# zig-detect-license
2
3![loc](https://sloc.xyz/github/nektro/zig-detect-license)
4[![license](https://img.shields.io/github/license/nektro/zig-detect-license.svg)](https://github.com/nektro/zig-detect-license/blob/master/LICENSE)
5[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)
6[![Zig](https://img.shields.io/badge/Zig-0.14-f7a41d)](https://ziglang.org/)
7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)
8
9Given an input text guess which SPDX license it most likely is an instance of
10
11## Usage
12- `pub fn detect(alloc: *std.mem.Allocator, license_src: []const u8) ![]const u8`
13 - Given an input string, will return the SPDX license identifier for the closest guess to which one it might be
14
15- `pub fn detectInDir(alloc: *std.mem.Allocator, dir: std.fs.Dir) !?[]const u8`
16 - Given a directory, will search for a `LICENSE` file and return the guess for which one it is. Will return `null` if the license file can not be found. If this returns null when you do indeed have a license file, please help expand the search examples by submitting a bug report.