Skip to main content

Python CLI which can find the entry of java project.

Project description

jentry

PyPI PyPI - Python Version Loc Comments

Docs Deploy Code Test Badge Creation Package Release codecov

GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

A simple tools to get the entries of a java projects, based on 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.

Quick Start

Use with CLI

You can directly use jentry CLI to get the entry of a java project. Such as the command below

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

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

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.

jentry -f json demo

The json-formatted output.

[
    {
        "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

jentry -f table demo

A table with all the entries will be placed together.

+---------------+----------+-------+----------------------------------------------------------------+
|     Entry     | Package  | Class |                            Filename                            |
+---------------+----------+-------+----------------------------------------------------------------+
|      Main     |  <none>  |  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.

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

from jentry.entry.script import load_entries_from_project

if __name__ == '__main__':
    for entry in load_entries_from_project('demo'):
        print(repr(entry))

The output should be

<JavaEntry class: Main, filename: 'demo/2018_spring_16061104_10/src/Main.java'>
<JavaEntry class: homework.Main, filename: 'demo/oo_course_2019_17373331_homework_2/src/homework/Main.java'>

License

jentry released under the Apache 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jentry-1.0.1.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

jentry-1.0.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file jentry-1.0.1.tar.gz.

File metadata

  • Download URL: jentry-1.0.1.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for jentry-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9046eeb2ec7b0acb240f356b88a21f1857fb8795ce45f739499d6b742a9c6cf5
MD5 2c654bdd34232c6bb8c16b68c6b7f7e7
BLAKE2b-256 c8fd882a74178090af29b848815128afb27fc2d0acb77d15149c041d66c8e6d6

See more details on using hashes here.

File details

Details for the file jentry-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: jentry-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for jentry-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc44ca69b8b50e48be452c5c45976c084369b434428cbd6984d4b20d68078690
MD5 f8f6b1174cc38eda09ba8d2d56129682
BLAKE2b-256 53366f0eaa861d413352042f64ef8f13da946f7d289b649afa636483b4705c10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page