Skip to main content

Finds function definitions/signatures from the command line.

Project description

Finds and prints function definitions/signatures in source code files. It currently handles JavaScript, Shell, Python (classes too, since they’re just functions anyway :smile:), and C-style function definitions, as well as Makefile targets. It will highlight the body of the functions for readability.

Dependencies

These are installable with pip:

Name

Description

colr

Terminal colors.

docopt

Command line argument parsing.

printdebug

Debug printing for command line tools.

pygments

Source code highlighting.

Installation:

This package is listed on PyPi, and is installable with pip:

pip install findfunc

Usage

Usage:
    findfunc -h | -v
    findfunc PAT [PATH...] [-a] [--color] [-D] [-S] [-s]
             [-c pat] [-C pat] [-e pat] [-f pat] [-l num] [-m num]

Options:
    PATH                   : Zero or more file paths to search.
                             If the path is a directory it will be walked.
                             Default: stdin
    PAT                    : Function name or regex pattern to search for.
    -a,--any               : Matches anywhere in the name.
                             This is the same as: (.+?pattern|pattern.+?)
    --color                : Always use color.
    -c pat,--contains pat  : Only show definitions that contain this
                             pattern in the body.
    -C pat,--without pat   : Only show definitions that do not contain
                             this pattern in the body.
                             This cancels out any -c pattern.
    -D,--debug             : Print some debugging info while running.
    -e pat,--exclude pat   : Regex pattern to exclude file paths.
    -f pat,--filter pat    : Regex pattern to include file paths.
    -h,--help              : Show this help message.
    -l num,--length num    : Show definitions that match this line length.
                             Tests can be prepended:
                                 >N  : More than N lines.
                                 <N  : Less than N lines.
                                >=N  : More than or equal to N lines.
                                <=N  : Less than or equal to N lines.
                                 =N  : Exactly N lines.
                                ==N  : Exactly N lines.
                                  N  : Exactly N lines.
    -m num,--maxcount num  : Maximum number of definitions to show.
    -S,--signature         : Just print the signatures found.
    -s,--short             : Use shorter output mode.
    -v,--version           : Show version.

Demo

Here is a recording showing FindFunc’s output when ran multiple times for various file types:

asciicast

Instead of typing each command, I made a script to do it for me. So it may seem a little fast. It’s running findfunc PATTERN DIR_OR_FILE with or without a --maxcount or --signature flag set.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FindFunc-0.4.3.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file FindFunc-0.4.3.tar.gz.

File metadata

  • Download URL: FindFunc-0.4.3.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for FindFunc-0.4.3.tar.gz
Algorithm Hash digest
SHA256 df4bd1152da7e400054c558968b5b6ce7101aff0a5e1e744140ed01e4586dc18
MD5 3f50b1d1762e1b05dfb2f2bfad196ce9
BLAKE2b-256 69a03eeb87561ee3f04cd8a1d124e87cbcb43b3110a98fa9ef66e204066ab59f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page