Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rudifa/sourcekitten-calltree
python script, extracts a calltree from `sourcekitten structure --file myfile.swift`
https://github.com/rudifa/sourcekitten-calltree
Last synced: 24 days ago
JSON representation
python script, extracts a calltree from `sourcekitten structure --file myfile.swift`
- Host: GitHub
- URL: https://github.com/rudifa/sourcekitten-calltree
- Owner: rudifa
- Created: 2023-01-26T21:29:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-28T14:32:58.000Z (almost 2 years ago)
- Last Synced: 2024-10-06T01:41:22.213Z (about 1 month ago)
- Language: Python
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# generate a calltree for a swift file
```
sourcekitten-calltree % sourcekitten_calltree.py -h [main|✔]
usage: sourcekitten_calltree.py [-h] [--file FILE] [-x EXCLUDE]Process a json file generated by sourcekitten --structure and generate a calltree.
optional arguments:
-h, --help show this help message and exit
--file FILE the file to process
-x EXCLUDE, --exclude EXCLUDE
exclude identifiers from the call treeHow to generate a calltree for a Swift file:
1. sourcekitten structure --file .swift | python3 sourcekitten_calltree.py
2. or, in two steps:
2.1. sourcekitten structure --file .swift > .json
2.2. python3 sourcekitten_calltree.py .json
3. this script generates two calltree files in subdirectory graphviz-output/:
3.1 .calltree.gv
3.2 .calltree.gv.pdf and opens it in Preview.
4. if needed, install sourcekitten first:
brew install sourcekitten
5. You can exclude uninteresting functions from the calltree by passing them as a comma-separated list, e.g.:
./sourcekitten_calltree.py --file .json -x print,String,Int```
### issues
- none known