capsuleName :: String -- ^ Old name
              -> Options -- ^ options
              -> String -- ^ New name
  capsuleName old opts = newname ++ "-" ++ show major ++ "." ++ show minor
    where (oldname, oldmaj, oldmin) = case reverse (splitOneOf "-." old) of
            [name] -> (name, 0, 0)
            (minor : major : name) -> 
              (intercalate "-" . reverse $ name, read major :: Int, read minor :: Int)
          (newname, major, minor) = case optNewCapsule opts of
            Just n -> (n, oldmaj, oldmin)
            Nothing -> if optMajorRevision opts 
              then (oldname, oldmaj + 1, 0) 
              else (oldname, oldmaj, oldmin + 1)

  -- Copy the old capsule to a new version location
capsuleName :: String -- ^ Old name
              -> Options -- ^ options
              -> String
capsuleName old opts = newname ++ "-" ++ show major ++ "." ++ show minor
    where (oldname, oldmaj, oldmin) = case reverse (splitOneOf "-." old) of
            [name] -> (name, 0, 0)
            (minor : major : name) -> 
              (intercalate "-" . reverse $ name, read major :: Int, read minor :: Int)
          (newname, major, minor) = case optNewCapsule opts of
            Just n -> (n, oldmaj, oldmin)
            Nothing -> if optMajorRevision opts 
              then (oldname, oldmaj + 1, 0) 
              else (oldname, oldmaj, oldmin + 1)

  -- Copy the old capsule to a new version location
capsuleName old opts = newname ++ "-" ++ show major ++ "." ++ show minor
    where (oldname, oldmaj, oldmin) = case reverse (splitOneOf "-." old) of
            [name] -> (name, 0, 0)
            (minor : major : name) -> 
              (intercalate "-" . reverse $ name, read major :: Int, read minor :: Int)
          (newname, major, minor) = case optNewCapsule opts of
            Just n -> (n, oldmaj, oldmin)
            Nothing -> if optMajorRevision opts 
              then (oldname, oldmaj + 1, 0) 
              else (oldname, oldmaj, oldmin + 1)

  -- Copy the old capsule to a new version location