https://github.com/hansbug/jentry
Python CLI which can find the entry of java project.
https://github.com/hansbug/jentry
entrypoints java judge-system python3
Last synced: 5 months ago
JSON representation
Python CLI which can find the entry of java project.
- Host: GitHub
- URL: https://github.com/hansbug/jentry
- Owner: HansBug
- License: apache-2.0
- Created: 2022-02-02T04:12:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-20T01:50:58.000Z (over 3 years ago)
- Last Synced: 2025-01-30T04:45:37.356Z (6 months ago)
- Topics: entrypoints, java, judge-system, python3
- Language: Python
- Homepage: https://hansbug.github.io/jentry/
- Size: 5.84 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# jentry
[](https://pypi.org/project/jentry/)
[](https://pypi.org/project/jentry/)

[](https://github.com/HansBug/jentry/actions?query=workflow%3A%22Docs+Deploy%22)
[](https://github.com/HansBug/jentry/actions?query=workflow%3A%22Code+Test%22)
[](https://github.com/HansBug/jentry/actions?query=workflow%3A%22Badge+Creation%22)
[](https://github.com/HansBug/jentry/actions?query=workflow%3A%22Package+Release%22)
[](https://codecov.io/gh/HansBug/jentry)[](https://github.com/HansBug/jentry/stargazers)
[](https://github.com/HansBug/jentry/network)

[](https://github.com/HansBug/jentry/issues)
[](https://github.com/HansBug/jentry/pulls)
[](https://github.com/HansBug/jentry/graphs/contributors)
[](https://github.com/HansBug/jentry/blob/master/LICENSE)A simple tools to get the entries of a java projects, based on [javalang](https://github.com/c2nes/javalang) library.
## Installation
You can simply install it with `pip` command line from the official PyPI site.
```
pip install jentry
```For more information about installation, you can refer to the [installation guide](https://hansbug.github.io/jentry/main/tutorials/installation/index.html).
## Quick Start
### Use with CLI
You can directly use `jentry` CLI to get the entry of a java project. Such as the command below
```bash
jentry demo
```The output should be like as shown follow (in this project, we have 2 different entries)
```
Main
homework.Main
```### Only Use One Entry
You can get exactly one entry with `-F` command
```bash
jentry -F demo
```The output should be
```
Main
```This command can be used when you are trying to run a compiled java project, like this
```bash
java -cp target:${CLASSPATH} $(jentry -F demo)
```The entry it found will be applied into the `java` command line.
### Pretty Print Entry
Actually, these entries can be printed with prettier ways, such as json and table.
```bash
jentry -f json demo
```The json-formatted output.
```json
[
{
"entrance": "Main",
"package": null,
"class": "Main",
"file": "demo/2018_spring_16061104_10/src/Main.java"
},
{
"entrance": "homework.Main",
"package": "homework",
"class": "Main",
"file": "demo/oo_course_2019_17373331_homework_2/src/homework/Main.java"
}
]
```And if the `-f` option is assigned to `table`
```bash
jentry -f table demo
```A table with all the entries will be placed together.
```
+---------------+----------+-------+----------------------------------------------------------------+
| Entry | Package | Class | Filename |
+---------------+----------+-------+----------------------------------------------------------------+
| Main | | Main | demo/2018_spring_16061104_10/src/Main.java |
| homework.Main | homework | Main | demo/oo_course_2019_17373331_homework_2/src/homework/Main.java |
+---------------+----------+-------+----------------------------------------------------------------+
```### Others
Other features can be found in the help information, which can be displayed with `-h` option.
```bash
jentry -h
``````
Usage: jentry [OPTIONS] [SOURCES]...Jentry - find the entry of your java project.
Options:
-v, --version Show package's version information.
-f, --format [table|json|entry]
The format to display the entries [default:
entry]
-s, --sorted_by [file|package|class|entry]
The order to sorted by. [default: file]
-r, --reverse Reverse the sorted result, only applied when
-s is used. [default: False]
-F, --first_only Only show the first entry. [default: False]
-h, --help Show this message and exit.
```### Use with Python
`jentry` can be imported into python
```python
from jentry.entry.script import load_entries_from_projectif __name__ == '__main__':
for entry in load_entries_from_project('demo'):
print(repr(entry))```
The output should be
```
```
## License
`jentry` released under the Apache 2.0 license.