{"id":23284210,"url":"https://github.com/agilecreativity/code_lister","last_synced_at":"2025-09-12T15:35:18.377Z","repository":{"id":15972663,"uuid":"18715476","full_name":"agilecreativity/code_lister","owner":"agilecreativity","description":"List/filter files based on simple concept like 'find' command in Linux/Unix based system","archived":false,"fork":false,"pushed_at":"2017-12-31T01:47:25.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T12:58:10.830Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/agilecreativity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-04-12T21:47:09.000Z","updated_at":"2017-12-31T01:47:23.000Z","dependencies_parsed_at":"2022-08-04T07:15:21.021Z","dependency_job_id":null,"html_url":"https://github.com/agilecreativity/code_lister","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/agilecreativity/code_lister","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Fcode_lister","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Fcode_lister/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Fcode_lister/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Fcode_lister/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agilecreativity","download_url":"https://codeload.github.com/agilecreativity/code_lister/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Fcode_lister/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274831643,"owners_count":25357883,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-20T01:38:41.669Z","updated_at":"2025-09-12T15:35:18.326Z","avatar_url":"https://github.com/agilecreativity.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## code_lister\n\n[![Gem Version](https://badge.fury.io/rb/code_lister.svg)](http://badge.fury.io/rb/code_lister)\n[![Dependency Status](https://gemnasium.com/agilecreativity/code_lister.png)](https://gemnasium.com/agilecreativity/code_lister)\n[![Code Climate](https://codeclimate.com/github/agilecreativity/code_lister.png)](https://codeclimate.com/github/agilecreativity/code_lister)\n\nFind/filter files based on simple criteria like `extension`, include/exclude some words in the name.\nIt provides the functionality similar to subset of `find | grep` command in Linux/Unix system.\n\nInitially this was part of my internal project. I extracted this out as a gem so\nthat I can re-use it in other project.\n\nNote: starting from version `0.1.0` this gem will follow the [Semantic Versioning] convention.\n\n### NOTES\n\n- Starting from version 0.2.0 only ruby 2.1.0+ are supported (use refinement instead of monkeypatching)\n- Use version 0.1.x if you need to use with ruby 1.9.3\n\n### Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'code_lister'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install code_lister\n\n### Usage\n\n#### Using as CLI interface\n\nList all pdf and epub files in the `/opts/downloads/` directory recursively\n\n```sh\n$code_lister --base-dir /opt/downloads/ --exts pdf epub --recursive\n```\n\nUsage/Synopsis:\n\n```\nUsage:\n  code_lister\n\nOptions:\n  -b, [--base-dir=BASE_DIR]                # Base directory\n                                           # Default: . (current directory)\n  -e, [--exts=one two three]               # List of extensions to search for\n  -f, [--non-exts=one two three]           # List of files without extension to search for\n  -n, [--inc-words=one two three]          # List of words in the filename to be included with the result if any\n  -x, [--exc-words=one two three]          # List of words in the filename to be excluded from the result if any\n  -i, [--ignore-case], [--no-ignore-case]  # Ignore the case in the input filename\n                                           # Default: --ignore-case\n  -r, [--recursive], [--no-recursive]      # Search for files recursively\n                                           # Default: --recursive\n  -v, [--version], [--no-version]          # Display version information\n\nList files by extensions, patterns, and simple criteria\n```\n\nExample Usage:\n\n- Find all java and ruby files in a given directory\n\n```ruby\n# find all files that ends with '*.java' or '*.rb' in a given directory\ncode_lister -b spec/fixtures/ -e rb java\n```\n\nOutput:\n\n```\n./demo1.xxx.rb\n./demo1.yyy.rb\n./demo2.xxx.rb\n./demo2.yyy.rb\n./java/demo3.xxx.java\n./java/demo3.yyy.java\n./java/demo4.xxx.java\n./java/demo4.yyy.java\n```\n\n- Find all java java and ruby files but include only the files that contain the word `xxx`\n\n```sh\n$code_lister -b spec/fixtures/ -e rb java -n xxx\n```\n\nOutput:\n\n```\n./demo1.xxx.rb\n./demo2.xxx.rb\n./java/demo3.xxx.java\n./java/demo4.xxx.java\n```\n\n- Same as previous step, but filter out result that contain the word `demo3` or `demo4`\n\n```ruby\n$code_lister -b spec/fixtures/ -e rb java -n xxx -x demo3 demo4\n```\nOutput:\n\n```\n./demo1.xxx.rb\n./demo2.xxx.rb\n```\n\n#### Using as ruby library\n\nThis is probably the proper way to utilize the library as the CLI only serve to\nshow the result in the console.\n\nExample of how you might use the library in your own project.\n\n```ruby\nrequire 'code_lister'\ninclude CodeLister\n\n# To search for everything that ends in '*.java' and '*.rb\" recursively\nfile_list = CodeLister.files base_dir: \"spec/fixtures\",\n                             exts: %w(rb java),\n                             recursive: true\nputs file_list\n\n# To filter out the result you may do so with the `CodeLister.filter` method\nnew_list = CodeLister.filter(file_list, inc_words: %w(some list of word),\n                                        exc_words: %w(other text to excluded),\n                                        ignore_case: false)\n```\n\n### Development/Testing\n\n```sh\ngit clone https://github.com/agilecreativity/code_lister.git\ncd code_lister\nbundle\nrake -T\n\n# Play around with it using Pry\nrake pry\n```\n\nFrom inside `Pry`\n\n```ruby\ninclude CodeLister\n\n# To search for everything that ends in '*.java' and '*.rb\" recursively\nlist1 = CodeLister.files(base_dir: \"spec/fixtures\", exts: %w(rb java), recursive: true)\nputs list1\n\n# To filter out the result list\nlist2 = CodeLister.filter(list1, inc_words: %w(final complete), exc_words: %w(demo test))\n```\n\n## Contributing\n\n1. Fork it (http://github.com/agilecreativity/code_lister/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n[Semantic Versioning]: http://semver.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagilecreativity%2Fcode_lister","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagilecreativity%2Fcode_lister","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagilecreativity%2Fcode_lister/lists"}