Package convex.cli
Class Helpers
java.lang.Object
convex.cli.Helpers
Helpers
Helper functions for the CLI classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
createPath(File file)
Create a path from a File object.static String
expandTilde(String path)
Expand a path string with a '~'.static SessionItem
getSessionItem(String sessionFilename)
Return a random session hostname, by looking at the session file.static SessionItem
getSessionItem(String sessionFilename, int index)
Return an indexed session item, by looking at the session file.splitArrayParameter(String[] parameterValue)
-
Constructor Details
-
Helpers
public Helpers()
-
-
Method Details
-
expandTilde
Expand a path string with a '~'. The tilde is expanded to the users home path.- Parameters:
path
- Path string to expand.- Returns:
- Expanded string if a tilde is present.
-
createPath
Create a path from a File object. This is to provide a feature to add the default `.convex` folder if it does not exist.- Parameters:
file
- File object to see if the path part of the filename exists, if not then create it.
-
getSessionItem
Return a random session hostname, by looking at the session file. The session file has a list of local peers open. This helper will find a random peer in the collection and returns hostname.- Parameters:
sessionFilename
- Session filename to open and get the random port nummber.- Returns:
- A random hostname or null if none can be found
- Throws:
IOException
-
getSessionItem
Return an indexed session item, by looking at the session file. The session file has a list of local peers open. This helper will find a random peer in the collection and returns session item.- Parameters:
sessionFilename
- Session filename to open and get the random port nummber.index
- The index of the peer in the session list or if -1 a random selection is made.- Returns:
- A random session item or null if none can be found
- Throws:
IOException
-
splitArrayParameter
-