Skip to content

Commit

Permalink
修改terminal_width
Browse files Browse the repository at this point in the history
  • Loading branch information
gmctl committed May 17, 2019
1 parent c32f5b9 commit 90551df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def query_sqlite(workspace, target=None, repeat=None, summary=None):
loadavg = float('0.00')
banner = "celerystalk Status | Workspace Name: {0} | CPU Load Avg: {1}".format(workspace, str(loadavg))
print("*" * terminal_width)
print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner)
print("\n" + " " * ((terminal_width / 2) - 40) + "Submitted: {0} | Queued: {3} | Running: {2} | Completed: {1} | Cancelled: {4} | Paused: {5}".format(total_count[0][0], completed_count[0][0], len(running_rows), pending_count[0][0], len(cancelled_rows), len(paused_rows)))
print(" " * ( int(terminal_width / 2) - int(len(banner) / 2)) + banner)
print("\n" + " " * ( int(terminal_width / 2) - 40) + "Submitted: {0} | Queued: {3} | Running: {2} | Completed: {1} | Cancelled: {4} | Paused: {5}".format(total_count[0][0], completed_count[0][0], len(running_rows), pending_count[0][0], len(cancelled_rows), len(paused_rows)))
print("*" * terminal_width)

if summary:
Expand Down
4 changes: 2 additions & 2 deletions lib/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,15 @@ def report(workspace,target_list=None):
print("\n")
print("*" * terminal_width)
banner = "Combined Report files"
print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner )
print(" " * ( int(terminal_width / 2) - int(len(banner) / 2)) + banner )
print("*" * terminal_width + "\n")

print("[+] Report file (All workspace hosts): {0} (has screenshots!!!)".format(combined_report_file_name))
print("[+] Report file (All workspace hosts): {0}\n".format(combined_report_file_name_txt))

print("*" * terminal_width)
banner = "Suggestions for viewing your html report:"
print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner )
print(" " * (int(terminal_width / 2) - int(len(banner) / 2)) + banner )
print("*" * terminal_width + "\n")
print("[+] Option 1: Open with local firefox (works over ssh with x forwarding)")
print("\t\tfirefox " + combined_report_file_name + " &")
Expand Down
6 changes: 3 additions & 3 deletions lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,15 @@ def get_terminal_width():
:return: the current width of the terminal
"""
command = ['tput', 'cols']
width = 80
try:
width = int(subprocess.check_output(command))
except OSError as e:
print("Invalid Command '{0}': exit status ({1})".format(
command[0], e.errno))
width = 20

except subprocess.CalledProcessError as e:
print("Command '{0}' returned non-zero exit status: ({1})".format(
command, e.returncode))
width = 20
finally:
else: ## finnaly
return width

0 comments on commit 90551df

Please sign in to comment.