diff --git a/CmdDB.hs b/CmdDB.hs
--- a/CmdDB.hs
+++ b/CmdDB.hs
@@ -108,6 +108,14 @@
        , manual = Nothing
        }
   , CommandSpec {
+         command = Upload
+       , commandNames = ["upload", "up"]
+       , document = "Uploading tar.gz to HackageDB"
+       , routing = RouteCabal ["upload"]
+       , switches = [(SwNoharm, Just "-c")]
+       , manual = Nothing
+       }
+  , CommandSpec {
          command = Unpack
        , commandNames = ["unpack"]
        , document = "Untar a package in the current directory"
@@ -148,6 +156,14 @@
        , manual = Nothing
        }
   , CommandSpec {
+         command = GenPaths
+       , commandNames = ["genpaths", "genpath"]
+       , document = "Generate Paths_<pkg>.hs"
+       , routing = RouteFunc genpaths
+       , switches = []
+       , manual = Nothing
+       }
+  , CommandSpec {
          command = Search
        , commandNames = ["search"]
        , document = "Search available packages by package name"
@@ -302,7 +318,7 @@
 helpAndExit = do
     putStrLn $ programName ++ " " ++ " -- " ++ description
     putStrLn ""
-    putStrLn $ "Version: " ++ version
+    putStrLn $ "Version: " ++ showVersion version
     putStrLn "Usage:"
     putStrLn $ "\t" ++ programName
     putStrLn $ "\t" ++ programName ++ " <command> [args...]"
diff --git a/Commands.hs b/Commands.hs
--- a/Commands.hs
+++ b/Commands.hs
@@ -1,5 +1,6 @@
 module Commands (
-    deps, revdeps, installed, outdated, uninstall, search, env, check, add
+    deps, revdeps, installed, outdated, uninstall, search, env
+  , genpaths, check, add
   ) where
 
 import Control.Applicative hiding (many)
@@ -7,6 +8,7 @@
 import Data.Char
 import Data.List
 import Data.Maybe
+import GenPaths
 import PkgDB
 import System.Exit
 import System.IO
@@ -96,6 +98,11 @@
     Just path -> do
         pkgConf <- getPackageConf path
         return $ "--package-conf=" ++ pkgConf ++ " "
+
+----------------------------------------------------------------
+
+genpaths :: FunctionCommand
+genpaths _ _ _ = genPaths
 
 ----------------------------------------------------------------
 
diff --git a/GenPaths.hs b/GenPaths.hs
new file mode 100644
--- /dev/null
+++ b/GenPaths.hs
@@ -0,0 +1,84 @@
+{-# LANGUAGE OverloadedStrings, DoAndIfThenElse #-}
+
+module GenPaths (genPaths) where
+
+import Control.Applicative
+import Control.Monad
+import Data.Attoparsec.ByteString.Char8
+import Data.Attoparsec.Enumerator
+import Data.Enumerator (run, ($$))
+import Data.Enumerator.Binary (enumFile)
+import Data.List
+import System.Directory
+import System.IO
+
+genPaths :: IO ()
+genPaths = do
+    mnv <- getNameVersion
+    case mnv of
+        Nothing       -> hPutStrLn stderr "cabal file does not exist"
+        Just (nm,ver) -> do
+            let file = "Paths_" ++ nm ++ ".hs"
+            exist <- doesFileExist file
+            if exist then
+                hPutStrLn stderr $ file ++ " already exists"
+            else do
+                putStrLn $ "Writing " ++ file ++ "..."
+                writeFile file $
+                     "module Paths_" ++ nm ++ "  where\n"
+                  ++ "import Data.Version\n"
+                  ++ "\n"
+                  ++ "version :: Version\n"
+                  ++ "version = Version [" ++ ver' ++ "] []\n"
+          where
+            ver' = map trans ver
+            trans c
+              | c == '.'  = ','
+              | otherwise = c
+
+getNameVersion :: IO (Maybe (String,String))
+getNameVersion = do
+    mcfile <- getCabalFile
+    case mcfile of
+        Nothing -> return Nothing
+        Just cfile -> do
+            mn <- parseCabalFile cfile name
+            mv <- parseCabalFile cfile version
+            return $ do
+                n <- mn
+                v <- mv
+                return (n,v)
+
+getCabalFile :: IO (Maybe FilePath)
+getCabalFile = do
+    cnts <- (filter isCabal <$> getDirectoryContents ".")
+            >>= filterM (\file -> doesFileExist file)
+    case cnts of
+        []      -> return Nothing
+        cfile:_ -> return (Just cfile)
+  where
+    isCabal nm = ".cabal" `isSuffixOf` nm && length nm > 6
+
+parseCabalFile :: FilePath -> Parser a -> IO (Maybe a)
+parseCabalFile file parser = do
+    res <- run (enumFile file $$ iterParser (findTarget parser))
+    case res of
+        Right x -> return x
+        Left  _ -> return Nothing
+
+findTarget :: Parser a -> Parser (Maybe a)
+findTarget parser = (Just <$> parser)
+         <|> (anyChar >> findTarget parser)
+         <|> (Nothing <$ endOfInput)
+
+name :: Parser String
+name = do
+    stringCI "name:"
+    many (char ' ')
+    many1 (satisfy $ notInClass " ,\t\n")
+
+version :: Parser String
+version = do
+    stringCI "version:"
+    many (char ' ')
+    many1 (satisfy $ inClass "0-9.")
diff --git a/Program.hs b/Program.hs
--- a/Program.hs
+++ b/Program.hs
@@ -1,7 +1,10 @@
-module Program where
+module Program (
+    version, showVersion
+  , programName, description
+  ) where
 
-version :: String
-version = "0.1.6"
+import Paths_cab
+import Data.Version
 
 programName :: String
 programName = "cab"
diff --git a/Types.hs b/Types.hs
--- a/Types.hs
+++ b/Types.hs
@@ -67,11 +67,13 @@
              | Clean
              | Outdated
              | Sdist
+             | Upload
              | Unpack
              | Info
              | Deps
              | RevDeps
              | Check
+             | GenPaths
              | Search
              | Env
              | Add
diff --git a/cab.cabal b/cab.cabal
--- a/cab.cabal
+++ b/cab.cabal
@@ -1,5 +1,5 @@
 Name:                   cab
-Version:                0.1.7
+Version:                0.1.8
 Author:                 Kazu Yamamoto <kazu@iij.ad.jp>
 Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp>
 License:                BSD3
@@ -33,12 +33,14 @@
   Other-Modules:	CmdDB
                         Commands
                         Env
+                        GenPaths
                         PkgDB
                         Process
                         Program
                         Types
                         Utils
                         VerDB
+                        Paths_cab
 Source-Repository head
   Type:                 git
   Location:             git://github.com/kazu-yamamoto/cab.git
