main :: IO()
main = do repoDir:linkType:fromUID:toUIDs <- SysEnv.getArgs
          isRepo <- Spim.isSpimRepo repoDir
          if not isRepo 
              then do putStr ("Error: '" ++ repoDir ++ "' is not a spim repository")
                      Exit.exitWith (Exit.ExitFailure Spim.badRepoEC) 
              else do oldDir <- SysDir.getCurrentDirectory
                      SysDir.setCurrentDirectory repoDir
                      link <- Spim.loadLink linkType
                      let newLink = MD.add fromUID (List.intercalate "," toUIDs) link
                      Spim.saveLink newLink
                      SysDir.setCurrentDirectory oldDir
main :: IO()
main = do repoDir:linkType:fromUID:toUIDs <- SysEnv.getArgs
          isRepo <- Spim.isSpimRepo repoDir
          if not isRepo 
              then do putStr ("Error: '" ++ repoDir ++ "' is not a spim repository")
                      Exit.exitWith (Exit.ExitFailure Spim.badRepoEC) 
              else do oldDir <- SysDir.getCurrentDirectory
                      SysDir.setCurrentDirectory repoDir
                      link <- Spim.loadLink linkType
                      let newLink = MD.add fromUID (List.intercalate "," toUIDs) link
                      Spim.saveLink newLink
                      SysDir.setCurrentDirectory oldDir
main = do repoDir:linkType:fromUID:toUIDs <- SysEnv.getArgs
          isRepo <- Spim.isSpimRepo repoDir
          if not isRepo 
              then do putStr ("Error: '" ++ repoDir ++ "' is not a spim repository")
                      Exit.exitWith (Exit.ExitFailure Spim.badRepoEC) 
              else do oldDir <- SysDir.getCurrentDirectory
                      SysDir.setCurrentDirectory repoDir
                      link <- Spim.loadLink linkType
                      let newLink = MD.add fromUID (List.intercalate "," toUIDs) link
                      Spim.saveLink newLink
                      SysDir.setCurrentDirectory oldDir