4343
4444HELP_MESSAGE = """COMMANDS LIST
4545====================
46- All special commands start with '. '
46+ All special commands start with '/ '
4747----
48- >>> help: show this help message
48+ >>> / help: show this help message
4949----
50- >>> <tab>: autocomplete.
50+ >>> <tab>: autocomplete.
5151----
52- >>> . docs: print out documentation for DSL data objects.
53- >>> . export_as_json: save results from last query as JSON file.
54- >>> . export_as_csv: save results from last query as CSV file.
55- >>> . export_as_gist: save results from last query as Github GIST.
56- >>> . export_as_html: save results from last query as HTML file.
57- >>> . export_as_bar_chart: save results from last query as Plotly bar chart.
58- >>> . export_as_jupyter: save results from last query as Jupyter notebook.
59- >>> . export_as_gsheets: save results from last query as Google Sheets (requires gspread credentials).
60- >>> . show [optional: N]: print N results from last query, trying to build URLs for objects. Default N=10.
61- >>> . json_compact: print results of last query as single-line JSON.
62- >>> . json_full: print results of last query as formatted JSON.
63- >>> . url: resolve a Dimensions ID into a public URL.
52+ >>> / docs: print out documentation for DSL data objects.
53+ >>> / export_as_json: save results from last query as JSON file.
54+ >>> / export_as_csv: save results from last query as CSV file.
55+ >>> / export_as_gist: save results from last query as Github GIST.
56+ >>> / export_as_html: save results from last query as HTML file.
57+ >>> / export_as_bar_chart: save results from last query as Plotly bar chart.
58+ >>> / export_as_jupyter: save results from last query as Jupyter notebook.
59+ >>> / export_as_gsheets: save results from last query as Google Sheets (requires gspread credentials).
60+ >>> / show [optional: N]: print N results from last query, trying to build URLs for objects. Default N=10.
61+ >>> / json_compact: print results of last query as single-line JSON.
62+ >>> / json_full: print results of last query as formatted JSON.
63+ >>> / url: resolve a Dimensions ID into a public URL.
6464----
65- >>> <Ctrl-o>: search docs online.
65+ >>> <Ctrl-o>: search docs online (type a search query first).
6666>>> <Ctrl-c>: abort query.
6767>>> <Ctrl-d>: exit console.
6868----
69- >>> quit: exit console
69+ >>> / quit: exit console
7070====================
7171*ABOUT AUTOCOMPLETE*
7272Including a space between query elements (= keywords and operators) leads to better autocomplete results."""
7373
74- WELCOME_MESSAGE = "Welcome! Type help for more info."
74+ WELCOME_MESSAGE = "Welcome! Type / help for more info."
7575# WELCOME_MESSAGE = "Welcome! Type help for more info. Ready to query endpoint: %s"
7676
7777
@@ -105,16 +105,16 @@ def __init__(self, dslclient, databuffer):
105105
106106 def handle (self , text ):
107107 "process text and delegate"
108- if text .replace ("\n " , "" ).strip ().startswith (". show" ) or text .replace ("\n " , "" ).strip ().startswith (". json" ):
108+ if text .replace ("\n " , "" ).strip ().startswith ("/ show" ) or text .replace ("\n " , "" ).strip ().startswith ("/ json" ):
109109 self .show (text .replace ("\n " , "" ).strip ())
110110
111- elif text .replace ("\n " , "" ).strip ().startswith (". export" ):
111+ elif text .replace ("\n " , "" ).strip ().startswith ("/ export" ):
112112 self .export (text .replace ("\n " , "" ).strip ())
113113
114- elif text .replace ("\n " , "" ).strip ().startswith (". docs" ):
114+ elif text .replace ("\n " , "" ).strip ().startswith ("/ docs" ):
115115 self .docs_full (text .replace ("\n " , "" ).strip ())
116116
117- elif text .replace ("\n " , "" ).strip ().startswith (". url" ):
117+ elif text .replace ("\n " , "" ).strip ().startswith ("/ url" ):
118118 self .url_resolver (text .replace ("\n " , "" ).strip ())
119119
120120 else :
@@ -125,7 +125,7 @@ def url_resolver(self, text):
125125 """
126126 turn an ID into a Dimensions URL - print out results
127127 """
128- text = text .replace (". url" , "" ).strip ()
128+ text = text .replace ("/ url" , "" ).strip ()
129129 if len (text ) > 0 :
130130 print_dimensions_url (text )
131131
@@ -163,7 +163,7 @@ def docs_full(self, text):
163163 """
164164 print out docs infos from 'describe' API
165165 """
166- text = text .replace (". docs" , "" ).split ()
166+ text = text .replace ("/ docs" , "" ).split ()
167167 if len (text ) > 0 :
168168 if text [0 ] in G .entities ():
169169 res = self .dsl .query (f"describe entity { text [0 ]} " )
@@ -221,25 +221,25 @@ def export(self, text):
221221 CONNECTION = get_global_connection ()
222222 api_endpoint = CONNECTION .url
223223 # cases
224- if text == ". export_as_html" :
224+ if text == "/ export_as_html" :
225225 export_json_html (jsondata , query , api_endpoint , USER_EXPORTS_DIR )
226226
227- elif text == ". export_as_gist" :
227+ elif text == "/ export_as_gist" :
228228 export_gist (jsondata , query , api_endpoint )
229229
230- elif text == ". export_as_csv" :
230+ elif text == "/ export_as_csv" :
231231 export_json_csv (jsondata , query , USER_EXPORTS_DIR )
232232
233- elif text == ". export_as_json" :
233+ elif text == "/ export_as_json" :
234234 export_json_json (jsondata , query , USER_EXPORTS_DIR )
235235
236- elif text == ". export_as_bar_chart" :
236+ elif text == "/ export_as_bar_chart" :
237237 export_as_bar_chart (jsondata , query , USER_EXPORTS_DIR )
238238
239- elif text == ". export_as_jupyter" :
239+ elif text == "/ export_as_jupyter" :
240240 export_as_jupyter (jsondata , query , USER_EXPORTS_DIR )
241241
242- elif text == ". export_as_gsheets" :
242+ elif text == "/ export_as_gsheets" :
243243 export_as_gsheets_wrapper (jsondata , query )
244244
245245
@@ -259,14 +259,14 @@ def show(self, text):
259259 print ("Nothing to show - please run a search first." )
260260 return
261261 # cases
262- if text == ". json_compact" :
262+ if text == "/ json_compact" :
263263 print_json_compact (jsondata )
264- elif text == ". json_full" :
264+ elif text == "/ json_full" :
265265 print_json_full (jsondata )
266266 else :
267- # must be a simple ". show" + X command
267+ # must be a simple "/ show" + X command
268268 try :
269- no = text .replace (". show" , "" ).strip ()
269+ no = text .replace ("/ show" , "" ).strip ()
270270 slice_no = int (no )
271271 except ValueError :
272272 slice_no = DEFAULT_NO_RECORDS
@@ -333,9 +333,9 @@ def run(instance="live"):
333333 else :
334334 if text .strip () == "" :
335335 continue
336- elif text == "quit" :
336+ elif text == "/ quit" :
337337 break
338- elif text == "help" :
338+ elif text == "/ help" :
339339 click .secho (HELP_MESSAGE , dim = True )
340340 continue
341341 # cm = CommandsManager(CLIENT,databuffer)
0 commit comments