https://github.com/lzaoral/defloc
Finds locations of function definitions in shell scripts.
https://github.com/lzaoral/defloc
bash shell
Last synced: about 2 months ago
JSON representation
Finds locations of function definitions in shell scripts.
- Host: GitHub
- URL: https://github.com/lzaoral/defloc
- Owner: lzaoral
- License: gpl-3.0
- Created: 2021-12-07T13:23:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-24T17:47:19.000Z (over 4 years ago)
- Last Synced: 2025-02-11T15:58:05.812Z (over 1 year ago)
- Topics: bash, shell
- Language: Haskell
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# defloc
[](https://github.com/lzaoral/defloc/actions/workflows/haskell-ci.yml)
[](https://copr.fedorainfracloud.org/coprs/lzaoral/defloc/)
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=`.
4. `defloc` binary will be present in `` specified in the previous step.
5. ...
6. Profit!
### Fedora
You can setup [`defloc`'s COPR repository](https://copr.fedorainfracloud.org/coprs/lzaoral/defloc/)
using the following commands. Make sure you already have `dnf-plugins-core`
installed. Otherwise, `dnf` will not recognise the `copr` command.
```console
# dnf copr enable lzaoral/defloc
# dnf install defloc
```
## Usage
```shell
defloc function [scripts]
```
## Examples
```console
$ 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