forked from GitHub/gf-core
file name completion for command i
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
-- Do not use readline.
|
-- Do not use readline.
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.System.NoReadline (fetchCommand, setCompletionFunction) where
|
module GF.System.NoReadline (fetchCommand, setCompletionFunction, filenameCompletionFunction) where
|
||||||
|
|
||||||
import System.IO.Error (try)
|
import System.IO.Error (try)
|
||||||
import System.IO (stdout,hFlush)
|
import System.IO (stdout,hFlush)
|
||||||
@@ -28,3 +28,6 @@ fetchCommand s = do
|
|||||||
|
|
||||||
setCompletionFunction :: Maybe (String -> String -> Int -> IO [String]) -> IO ()
|
setCompletionFunction :: Maybe (String -> String -> Int -> IO [String]) -> IO ()
|
||||||
setCompletionFunction _ = return ()
|
setCompletionFunction _ = return ()
|
||||||
|
|
||||||
|
filenameCompletionFunction :: String -> IO [String]
|
||||||
|
filenameCompletionFunction _ = return []
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
-- Uses the right readline library to read user input.
|
-- Uses the right readline library to read user input.
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.System.Readline (fetchCommand, setCompletionFunction) where
|
module GF.System.Readline (fetchCommand, setCompletionFunction, filenameCompletionFunction) where
|
||||||
|
|
||||||
#ifdef USE_READLINE
|
#ifdef USE_READLINE
|
||||||
|
|
||||||
import GF.System.UseReadline (fetchCommand, setCompletionFunction)
|
import GF.System.UseReadline
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
import GF.System.NoReadline (fetchCommand, setCompletionFunction)
|
import GF.System.NoReadline
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
-- Use GNU readline
|
-- Use GNU readline
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.System.UseReadline (fetchCommand, setCompletionFunction) where
|
module GF.System.UseReadline (fetchCommand, setCompletionFunction, filenameCompletionFunction) where
|
||||||
|
|
||||||
import System.Console.Readline
|
import System.Console.Readline
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ wordCompletion cmdEnv line prefix p =
|
|||||||
ret (if null flg_compls then ' ' else '=')
|
ret (if null flg_compls then ' ' else '=')
|
||||||
(flg_compls++opt_compls)
|
(flg_compls++opt_compls)
|
||||||
Nothing -> ret ' ' []
|
Nothing -> ret ' ' []
|
||||||
|
CmplIdent (Just (Command "i" _ _)) _ -- HACK: file name completion for command i
|
||||||
|
-> filenameCompletionFunction prefix
|
||||||
CmplIdent _ pref
|
CmplIdent _ pref
|
||||||
-> do mb_abs <- try (evaluate (abstract pgf))
|
-> do mb_abs <- try (evaluate (abstract pgf))
|
||||||
case mb_abs of
|
case mb_abs of
|
||||||
|
|||||||
Reference in New Issue
Block a user