Git Product home page Git Product logo

fsrc's Introduction

fsrc (fast code search)

This tool is meant to search large codebases for text snippets. It uses a threadpool to open and search in all text files in the current folder. The string search is sse2 optimized code from mischasan.

Usage

user@home:/usr/include/boost$ fsrc
Usage  : fsrc [options] term
Options:
  -d [ --dir ] arg      Search folder
  -e [ --ext ] arg      Search only in files with extension <arg>, equiv. to 
                        --glob '*.ext'
  -f [ --files ]        Only print filenames
  -g [ --glob ] arg     Search only in files filtered by <arg> glob, e.g. 
                        '*.txt'; overrides --ext
  -h [ --help ]         Help
  --html                open web page with results
  -i [ --ignore-case ]  Case insensitive search
  --no-git              Disable search with 'git ls-files'
  --no-colors           Disable colorized output
  --no-piped            Disable piped output
  --no-uri              Print w/out file:// prefix
  --piped               Enable piped output
  -q [ --quiet ]        only print status
  -r [ --regex ]        Regex search (slower)

Build : v0.24 from Jun 18 2021
Web   : https://github.com/elsamuko/fsrc
user@home:/usr/include/boost$ fsrc filesystem
Searching for "filesystem" in folder:

...
/usr/include/boost/spirit/home/x3/support/utility/testing.hpp
L  11 : #include <boost/filesystem.hpp>
L  12 : #include <boost/filesystem/fstream.hpp>
L  16 :     namespace fs = boost::filesystem;
L 205 :         catch (const fs::filesystem_error& ex)
L 215 :         boost::filesystem::ifstream file(p);

Times: Recurse 22 ms, Read 83 ms, Search 14 ms, Collect 0 ms, Print 28 ms
Found 449 matches in 68/12520 files (108658 kB) in 34 ms
user@home:/usr/include/boost$

Behaviour

  • If there is a .git folder in the main search folder, it uses git ls-files to get all files to search in
  • a .git folder is never searched
  • hidden folders and files are searched
  • binaries are 'detected', if they contain two binary 0's within the first 100 bytes or are PDF or PostScript files.
  • it supports one option-less argument as search term
  • folders are set with -d
  • when printing a match in a long line, only 100 chars context are printed, which makes searching in minified sources easier
  • with --html you get the results as web page
  • with --glob you can filter filenames by glob

Architecture

fsrc has a simple architecture: https://elsamuko.github.io/fsrc/architecture.html

Building

Windows

You need VS2019 and cygwin.

Linux

You need g++ 9 or newer.

macOS

You need XCode 10 or later.

General

You need bash, cmake, curl and zip available from the command line.
Run ./deploy.sh to compile the current source and package it as zip file.
Run ./scripts/build_boost.sh to build boost deps.
You need Qt/qmake to open the fscr.pro build file.

fsrc's People

Contributors

elsamuko avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.