7||| Retrieves a value from the environment if the given key is present,
8||| otherwise it returns Nothing.
9getEnv : String -> IO (Maybe String)
12 is_nil <- nullStr str_ptr
15 else pure (Just str_ptr)
18 getEnv' = foreign FFI_C "getenv" (String -> IO String) key
20||| Sets an environment variable with a given value.
21||| Returns true if the operation was successful.
22setEnv : String -> String -> IO Bool
24 ok <- foreign FFI_C "setenv" (String -> String -> Int -> IO Int) key value 1
27||| Unsets an environment variable.
28||| Returns true if the variable was able to be unset.
29unsetEnv : String -> IO Bool
31 ok <- foreign FFI_C "unsetenv" (String -> IO Int) key
34getEnvironment : IO (List (String, String))
35getEnvironment = getAllPairs 0 []
37 getEnvPair : Int -> IO String
38 getEnvPair i = foreign FFI_C "getEnvPair" (Int -> IO String) i
40 splitEq : String -> (String, String)
42 -- FIXME: There has to be a better way to split this up
43 let (k, v) = break (== '=') str in
44 let (_, v') = break (/= '=') v in
47 getAllPairs : Int -> List String -> IO (List (String, String))
48 getAllPairs n acc = do
49 envPair <- getEnvPair n
50 is_nil <- nullStr envPair
52 then return $ reverse $ map splitEq acc
53 else getAllPairs (n + 1) (envPair :: acc)
55||| Quit with a particular exit code
57exit code = foreign FFI_C "exit" (Int -> IO ()) code
61time = do MkRaw t <- foreign FFI_C "idris_time" (IO (Raw Integer))
65usleep i = foreign FFI_C "usleep" (Int -> IO ()) i
67system : String -> IO Int
68system cmd = foreign FFI_C "system" (String -> IO Int) cmd
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list