{"id":16431403,"url":"https://github.com/stephencelis/brloptionparser","last_synced_at":"2025-03-21T04:32:06.655Z","repository":{"id":12795818,"uuid":"15469594","full_name":"stephencelis/BRLOptionParser","owner":"stephencelis","description":"A short wrapper for getopt_long(3). Command line options parsing for Objective-C.","archived":false,"fork":false,"pushed_at":"2015-09-29T11:37:20.000Z","size":248,"stargazers_count":50,"open_issues_count":3,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-12T08:29:59.762Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephencelis.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-27T08:12:59.000Z","updated_at":"2023-07-25T07:20:03.000Z","dependencies_parsed_at":"2022-09-06T11:50:59.099Z","dependency_job_id":null,"html_url":"https://github.com/stephencelis/BRLOptionParser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2FBRLOptionParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2FBRLOptionParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2FBRLOptionParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2FBRLOptionParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephencelis","download_url":"https://codeload.github.com/stephencelis/BRLOptionParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811346,"owners_count":16884305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T08:30:03.131Z","updated_at":"2024-10-28T09:21:38.364Z","avatar_url":"https://github.com/stephencelis.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BRLOptionParser [![Build Status][1]][2]\n\nA short wrapper for [getopt_long(3)][3] (and getopt_long_only(3)).\n\n[1]: https://img.shields.io/travis/stephencelis/BRLOptionParser.svg?style=flat\n[2]: https://travis-ci.org/stephencelis/BRLOptionParser\n[3]: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/getopt_long.3.html\n\n## Install\n\nWith [CocoaPods][4]:\n\n``` rb\n# Podfile\npod 'BRLOptionParser', '~\u003e 0.3.1'\n```\n\n[4]: http://cocoapods.org\n\n## Example\n\n``` objc\n// main.m\n#import \u003cBRLOptionParser/BRLOptionParser.h\u003e\n\nint main(int argc, const char * argv[])\n{\n    @autoreleasepool {\n        NSString *name = @\"world\";\n        BOOL verbose = NO;\n\n        BRLOptionParser *options = [BRLOptionParser new];\n\n        [options setBanner:@\"usage: %s [-n \u003cname\u003e] [-vh]\", argv[0]];\n        [options addOption:\"name\" flag:'n' description:@\"Your name\" argument:\u0026name];\n        [options addSeparator];\n        [options addOption:\"verbose\" flag:'v' description:nil value:\u0026verbose];\n        __weak typeof(options) weakOptions = options;\n        [options addOption:\"help\" flag:'h' description:@\"Show this message\" block:^{\n            printf(\"%s\", [[weakOptions description] UTF8String]);\n            exit(EXIT_SUCCESS);\n        }];\n\n        NSError *error = nil;\n        if (![options parseArgc:argc argv:argv error:\u0026error]) {\n            const char * message = error.localizedDescription.UTF8String;\n            fprintf(stderr, \"%s: %s\\n\", argv[0], message);\n            exit(EXIT_FAILURE);\n        }\n\n        if (verbose) {\n            fprintf(stderr, \"(Preparing to say hello...)\\n\");\n        }\n\n        printf(\"Hello, %s!\\n\", name.UTF8String);\n    }\n\n    return EXIT_SUCCESS;\n}\n```\n\nIn practice:\n\n```\n$ hello\nHello, world!\n$ hello -h\nusage: hello [-n \u003cname\u003e] [-vh]\n    -n, --name                       Your name\n\n    -v, --verbose\n    -h, --help                       Show this message\n$ hello -n\nhello: option `-n' requires an argument\n$ hello --name Stephen\nHello, Stephen!\n$ hello -vngoodbye\n(Preparing to say hello...)\nHello, goodbye!\n$ hello --goodbye\nhello: unrecognized option `--goodbye'\n```\n\n## License\n\nBRLOptionParser is available under the MIT license. See the LICENSE file\nfor more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephencelis%2Fbrloptionparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephencelis%2Fbrloptionparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephencelis%2Fbrloptionparser/lists"}