Acode, easily query area codes from the command line

Acode:

This is something I’ve wanted to be able to do for a while, so I finally coded up a little Zig program to do it. I’m quite tired after a long day and threw this together quickly for fun, there will be a proper readme and such this weekend, but this is a tool that lets you look up telephone area codes from the command line. Currently it’s limited to North America, but I want to make you able to look up country codes and other fun things too. It uses a teeny janky handrolled csv parser, but it does what I needed.

Supported Zig versions

Tested with latest Zig master as well as 0.16.0.

GitHub link

Output example

quin@Minix~/acode$ ./zig-out/bin/acode 303

The 303 area code is used in the following parts of Colorado:

Arvada, Aurora, Boulder, Brighton, Broomfield, Castle Rock, Castlewood, Columbine, Commerce City, Denver, Englewood, Highlands Ranch, Ken Caryl, Lafayette, Lakewood, Littleton, Longmont, Loveland, Northglenn, Parker, Southglenn, Thornton, Westminster, and Wheat Ridge.

quin@Minix~/acode$ ./zig-out/bin/acode 910

The 910 area code is used in the following parts of North Carolina:

Fayetteville, Fort Bragg, Jacksonville, Lumberton, and Wilmington.

quin@Minix~/acode$ ./zig-out/bin/acode 204

The 204 area code is used in the following parts of Manitoba:

Brandon, Dauphin, Flin Flon, Morden, Portage la Prairie, Selkirk, Steinbach, The Pas, Thompson, Winkler, and Winnipeg.

quin@Minix~/acode$

7 Likes

I’ve now updated acode to be able to support country codes!

quin@Minix~$ acode -c 61                                                                                                

Country code +61 is used by: Australia, Christmas Island, and Cocos-Keeling Islands.                                    

quin@Minix~$ acode 1 -c

Country code +1 is used by: Canada and United States.                                                                   

quin@Minix~$ acode -c +45                                                                                                

Country code +45 is used by: Denmark.                                                                                   

quin@Minix~$ acode -c 5894                                                                                              

Country code '+5894' not found.                                                                                         

quin@Minix~$                                                                                                            
1 Like