@@ -201,6 +201,10 @@ def get_reference_sequences_by_name(
201201Enters the sqlite3 command-line shell on a GenomicSQLite-compressed database.
202202
203203sqlite3_ARG: passed through to sqlite3 (see `sqlite3 -help`)
204+
205+
206+ Usage: genomicsqlite DB_FILENAME --compact [options|--help]
207+ [Re]compress and defragment an existing SQLite3 or GenomicSQLite database. See --compact --help for options
204208"""
205209
206210
@@ -213,7 +217,7 @@ def _cli():
213217 language bindings.
214218 """
215219
216- if "--compact" in sys .argv :
220+ if "--compact" in sys .argv or "-compact" in sys . argv :
217221 _compact (sys .argv [1 ], sys .argv [2 :])
218222 return
219223
@@ -226,7 +230,7 @@ def _cli():
226230 or next ((True for a in ("-h" , "-help" , "--help" ) if a in sys .argv ), False )
227231 ):
228232 print (
229- "Usage: genomicsqlite DB_FILENAME ([- readonly] [sqlite3_ARG ...] | --compact ...) " ,
233+ "Usage: genomicsqlite DB_FILENAME [-- readonly] [sqlite3_ARG ...]\n " ,
230234 file = sys .stderr ,
231235 )
232236 print (
@@ -236,6 +240,10 @@ def _cli():
236240 sys .exit (1 )
237241
238242 cfg = {}
243+ try :
244+ sys .argv [sys .argv .index ("--readonly" )] = "-readonly"
245+ except ValueError :
246+ pass
239247 if "-readonly" in sys .argv :
240248 cfg ["mode" ] = "ro"
241249 cfg = json .dumps (cfg )
@@ -292,7 +300,7 @@ def _compact(dbfilename, argv):
292300 prog = "genomicsqlite DB_FILENAME --compact" ,
293301 description = "[Re]compress and defragment an existing SQLite3 or GenomicSQLite database." ,
294302 )
295- parser .add_argument ("--compact" , action = "store_true" , help = argparse .SUPPRESS )
303+ parser .add_argument ("-compact" , "- -compact" , action = "store_true" , help = argparse .SUPPRESS )
296304 parser .add_argument (
297305 "-o" , dest = "out_filename" , type = str , help = "compacted database path [DB_FILENAME.compact]"
298306 )
@@ -337,7 +345,7 @@ def _compact(dbfilename, argv):
337345
338346 # open db (sniffing whether it's currently compressed or not)
339347 con = None
340- web = next (( True for pfx in ( "http:" , "https:" ) if dbfilename .startswith (pfx )), False )
348+ web = dbfilename . startswith ( "http:" ) or dbfilename .startswith ("https:" )
341349 if not web :
342350 con = sqlite3 .connect (f"file:{ urllib .parse .quote (dbfilename )} ?mode=ro" , uri = True )
343351 if next (con .execute ("PRAGMA application_id" ))[0 ] == 0x7A737464 :
0 commit comments