Package convex.cli

Class Helpers

java.lang.Object
convex.cli.Helpers

public class Helpers extends Object
Helpers Helper functions for the CLI classes.
  • Constructor Details

    • Helpers

      public Helpers()
  • Method Details

    • expandTilde

      public static String expandTilde(String path)
      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

      public static void createPath(File file)
      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

      public static SessionItem getSessionItem(String sessionFilename) throws IOException
      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

      public static SessionItem getSessionItem(String sessionFilename, int index) throws IOException
      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

      public static List<String> splitArrayParameter(String[] parameterValue)