Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 1.39 KB

README.md

File metadata and controls

63 lines (46 loc) · 1.39 KB

defloc

Haskell CI Copr build status

Simple tool based on ShellCheck's parser that can be used to find definitions of functions in shell scripts.

Installation

Manual

Make sure you have cabal installed (at least v3 recommended).

  1. Clone this repository.
  2. Run cabal update.
  3. Run cabal install --installdir=<path>.
  4. defloc binary will be present in <path> specified in the previous step.
  5. ...
  6. Profit!

Fedora

You can setup defloc's COPR repository using the following commands. Make sure you already have dnf-plugins-core installed. Otherwise, dnf will not recognise the copr command.

# dnf copr enable lzaoral/defloc
# dnf install defloc

Usage

defloc function [scripts]

Examples

$ cat test.sh
#!/usr/bin/env sh

foo() {
    :
}

foo() (
    :
)

function foo1() {
    :
}

$ defloc foo test.sh
test.sh:foo:3:1-5:2
test.sh:foo:7:1-9:2
test.sh:foo1:11:1-13:2

# You can use regular expressions as well.
$ defloc 'foo\d' test.sh
test.sh:foo1:11:1-13:2