Skip to content

Commit ae7bcbc

Browse files
committed
Update CLI to add option to show current CyberPanel version
1 parent de5bb17 commit ae7bcbc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

cli/cliParser.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import argparse
2+
import re
23

34
class cliParser:
45

56
def prepareArguments(self):
6-
## Website creation arguemtns
7+
## Website creation Arguments
78

89
parser = argparse.ArgumentParser(description='CyberPanel Command Line Interface!')
910
parser.add_argument('function', help='Specific a operation to perform!')
@@ -22,7 +23,7 @@ def prepareArguments(self):
2223
parser.add_argument('--openBasedir', help='To enable or disable open_basedir protection for domain.')
2324
parser.add_argument('--fileName', help='Complete path to a file that needs to be restored.')
2425

25-
## Package arguments.
26+
## Package Arguments.
2627

2728
parser.add_argument('--packageName', help='Package name.')
2829
parser.add_argument('--diskSpace', help='Package disk space in MBs')
@@ -49,10 +50,19 @@ def prepareArguments(self):
4950
parser.add_argument('--dbPassword', help='Database password.')
5051
parser.add_argument('--databaseWebsite', help='Database website.')
5152

52-
## Email arguments
53+
## Email Arguments
5354
parser.add_argument('--userName', help='Email Username.')
5455
parser.add_argument('--password', help='Email password.')
5556

56-
57+
## Get CurrentVersion
58+
with open('/usr/local/CyberCP/version.txt') as file:
59+
file_contents = file.read()
60+
version = re.search('\d.\d', file_contents)
61+
version = version.group()
62+
build = file_contents[-2:]
63+
build = build[0:1]
64+
currentversion = version + '.' + build
65+
parser.add_argument('--version', action='version', version=currentversion)
66+
parser.parse_args(['--version'])
5767

5868
return parser.parse_args()

0 commit comments

Comments
 (0)