2011-11-12 19:18:52 -05:00
|
|
|
! Copyright (C) 2011 John Benediktsson
|
|
|
|
! See http://factorcode.org/license.txt for BSD license
|
2020-05-20 23:26:02 -04:00
|
|
|
USING: accessors command-line io.pathnames kernel namespaces
|
|
|
|
sequences strings system ui.operations urls vocabs ;
|
2011-11-12 19:18:52 -05:00
|
|
|
IN: webbrowser
|
|
|
|
|
2016-12-17 21:23:24 -05:00
|
|
|
HOOK: open-item os ( item -- )
|
2011-11-12 19:18:52 -05:00
|
|
|
|
2014-11-13 16:00:44 -05:00
|
|
|
"webbrowser." os name>> append require
|
2011-11-12 19:18:52 -05:00
|
|
|
|
2011-11-13 19:31:52 -05:00
|
|
|
: open-url ( url -- )
|
2016-12-17 21:23:24 -05:00
|
|
|
>url open-item ;
|
2012-09-22 19:49:53 -04:00
|
|
|
|
2016-12-17 20:58:04 -05:00
|
|
|
PREDICATE: url-string < string >url protocol>> >boolean ;
|
2012-09-22 19:49:53 -04:00
|
|
|
|
2016-12-17 21:23:24 -05:00
|
|
|
[ pathname? ] \ open-item H{ } define-operation
|
|
|
|
[ [ url? ] [ url-string? ] bi or ] \ open-url H{ } define-operation
|
2020-05-20 23:26:02 -04:00
|
|
|
|
|
|
|
: webbrowser-main ( -- )
|
|
|
|
command-line get [ open-url ] each ;
|
|
|
|
|
|
|
|
MAIN: webbrowser-main
|