Skip to content
/ defloc Public

Finds locations of function definitions in shell scripts.

License

Notifications You must be signed in to change notification settings

lzaoral/defloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Finds locations of function definitions in shell scripts.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published