Mercurial > hg > sonic-visualiser
comparison vext.sml @ 1716:e64981b88943 vext
Update vext
author | Chris Cannam |
---|---|
date | Tue, 20 Jun 2017 11:44:32 +0100 |
parents | 975dee07ff5c |
children | 434be2f0509e |
comparison
equal
deleted
inserted
replaced
1712:fb3bce15f480 | 1716:e64981b88943 |
---|---|
31 Particular Programs Ltd shall not be used in advertising or | 31 Particular Programs Ltd shall not be used in advertising or |
32 otherwise to promote the sale, use or other dealings in this | 32 otherwise to promote the sale, use or other dealings in this |
33 Software without prior written authorization. | 33 Software without prior written authorization. |
34 *) | 34 *) |
35 | 35 |
36 val vext_version = "0.0.1" | 36 val vext_version = "0.9.0" |
37 | 37 |
38 | 38 |
39 datatype vcs = | 39 datatype vcs = |
40 HG | | 40 HG | |
41 GIT | 41 GIT |
287 end | 287 end |
288 | 288 |
289 val tick_cycle = ref 0 | 289 val tick_cycle = ref 0 |
290 val tick_chars = Vector.fromList (map String.str (explode "|/-\\")) | 290 val tick_chars = Vector.fromList (map String.str (explode "|/-\\")) |
291 | 291 |
292 fun tick name = | 292 fun tick libname cmdlist = |
293 let val n = Vector.length tick_chars | 293 let val n = Vector.length tick_chars |
294 fun pad_to n str = | 294 fun pad_to n str = |
295 if n <= String.size str then str | 295 if n <= String.size str then str |
296 else pad_to n (str ^ " ") | 296 else pad_to n (str ^ " ") |
297 in | 297 val name = if libname <> "" then libname |
298 print ("\r " ^ | 298 else if cmdlist = nil then "" |
299 else hd (rev cmdlist) | |
300 in | |
301 print (" " ^ | |
299 Vector.sub(tick_chars, !tick_cycle) ^ " " ^ | 302 Vector.sub(tick_chars, !tick_cycle) ^ " " ^ |
300 pad_to 24 name); | 303 pad_to 24 name ^ |
304 "\r"); | |
301 tick_cycle := (if !tick_cycle = n - 1 then 0 else 1 + !tick_cycle) | 305 tick_cycle := (if !tick_cycle = n - 1 then 0 else 1 + !tick_cycle) |
302 end | 306 end |
303 | 307 |
304 fun run_command context libname cmdlist redirect = | 308 fun run_command context libname cmdlist redirect = |
305 let open OS | 309 let open OS |
306 val dir = libpath context libname | 310 val dir = libpath context libname |
307 val cmd = expand_commandline cmdlist | 311 val cmd = expand_commandline cmdlist |
308 val _ = if verbose () | 312 val _ = if verbose () |
309 then print ("Running: " ^ cmd ^ | 313 then print ("Running: " ^ cmd ^ |
310 " (in dir " ^ dir ^ ")...\n") | 314 " (in dir " ^ dir ^ ")...\n") |
311 else tick libname | 315 else tick libname cmdlist |
312 val _ = FileSys.chDir dir | 316 val _ = FileSys.chDir dir |
313 val status = case redirect of | 317 val status = case redirect of |
314 NONE => Process.system cmd | 318 NONE => Process.system cmd |
315 | SOME file => Process.system (cmd ^ ">" ^ file) | 319 | SOME file => Process.system (cmd ^ ">" ^ file) |
316 in | 320 in |
1627 version (); | 1631 version (); |
1628 print ("\nA simple manager for third-party source code dependencies.\n\n" | 1632 print ("\nA simple manager for third-party source code dependencies.\n\n" |
1629 ^ "Usage:\n\n" | 1633 ^ "Usage:\n\n" |
1630 ^ " vext <command>\n\n" | 1634 ^ " vext <command>\n\n" |
1631 ^ "where <command> is one of:\n\n" | 1635 ^ "where <command> is one of:\n\n" |
1636 ^ " status print quick report on local status only, without using network\n" | |
1632 ^ " review check configured libraries against their providers, and report\n" | 1637 ^ " review check configured libraries against their providers, and report\n" |
1633 ^ " status print quick report on local status only, without using network\n" | |
1634 ^ " install update configured libraries according to project specs and lock file\n" | 1638 ^ " install update configured libraries according to project specs and lock file\n" |
1635 ^ " update update configured libraries and lock file according to project specs\n" | 1639 ^ " update update configured libraries and lock file according to project specs\n" |
1636 ^ " version print the Vext version number and exit\n\n"); | 1640 ^ " version print the Vext version number and exit\n\n"); |
1637 OS.Process.failure) | 1641 OS.Process.failure) |
1638 | 1642 |