@@ -57,7 +57,6 @@ import Data.Text (Text)
5757import Data.Text qualified as Text
5858import Data.Time.Clock (UTCTime )
5959import Data.Time.Format (defaultTimeLocale , parseTimeOrError )
60- import Data.Type.Equality
6160import Data.Word
6261import GHC.Exts (IsList (.. ))
6362import GHC.Natural (Natural )
@@ -74,7 +73,6 @@ import Text.Parsec.Token qualified as Parsec
7473import Text.Read (readEither , readMaybe )
7574import Text.Read qualified as Read
7675
77- import Type.Reflection qualified as TR
7876import Vary (Vary , (:|) )
7977import Vary qualified
8078
@@ -1770,15 +1768,6 @@ pPoolIdOutputFormat =
17701768 , Opt. value IdOutputFormatBech32
17711769 ]
17721770
1773- -- | @pOutputFormatJsonOrText kind@ is a parser to specify in which format
1774- -- to view some data (json or text). @kind@ is the kind of data considered.
1775- pOutputFormatJsonOrText :: String -> Parser (Vary [FormatJson , FormatText ])
1776- pOutputFormatJsonOrText kind =
1777- asum
1778- [ make' FormatJson " JSON" " json" (Just " Default format when writing to a file" ) kind
1779- , make' FormatText " TEXT" " text" (Just " Default format when writing to stdout" ) kind
1780- ]
1781-
17821771-- | Make a parser for an output format.
17831772make'
17841773 :: a :| fs
@@ -1845,74 +1834,6 @@ flagFormatYaml
18451834flagFormatYaml =
18461835 mkFlag " output-yaml" " YAML" FormatYaml
18471836
1848- -- | @pTxIdOutputFormatJsonOrText kind@ is a parser to specify in which format
1849- -- to write @transaction txid@'s output on standard output.
1850- pTxIdOutputFormatJsonOrText :: Parser (Vary [FormatJson , FormatText ])
1851- pTxIdOutputFormatJsonOrText =
1852- asum [make FormatJson " JSON" " json" , make FormatText " TEXT" " text" ]
1853- <|> pure (Vary. from default_)
1854- where
1855- default_ :: FormatText
1856- default_ = FormatText
1857- make
1858- :: forall a fs
1859- . a :| fs
1860- => Typeable a
1861- => a
1862- -> String
1863- -> String
1864- -> Parser (Vary fs )
1865- make format desc flag_ =
1866- Opt. flag' (Vary. from format) $
1867- mconcat
1868- [ Opt. help $ " Format output as " <> desc <> maybeDefault <> " ."
1869- , Opt. long (" output-" <> flag_)
1870- ]
1871- where
1872- maybeDefault =
1873- case TR. eqTypeRep (TR. typeRep @ a ) (TR. typeRep @ FormatText ) of
1874- Just HRefl -> " (the default)"
1875- Nothing -> " "
1876-
1877- pTxViewOutputFormat :: Parser (Vary [FormatJson , FormatYaml ])
1878- pTxViewOutputFormat = pViewOutputFormat " transaction"
1879-
1880- pGovernanceActionViewOutputFormat :: Parser (Vary [FormatJson , FormatYaml ])
1881- pGovernanceActionViewOutputFormat = pViewOutputFormat " governance action"
1882-
1883- pGovernanceVoteViewOutputFormat :: Parser (Vary [FormatJson , FormatYaml ])
1884- pGovernanceVoteViewOutputFormat = pViewOutputFormat " governance vote"
1885-
1886- -- | @pViewOutputFormat kind@ is a parser to specify in which format
1887- -- to view some data (json or yaml). @what@ is the kind of data considered.
1888- pViewOutputFormat :: String -> Parser (Vary [FormatJson , FormatYaml ])
1889- pViewOutputFormat kind =
1890- asum
1891- [ make FormatJson " JSON" " json" Nothing
1892- , make FormatYaml " YAML" " yaml" (Just " Defaults to JSON if unspecified." )
1893- ]
1894- where
1895- make
1896- :: a :| fs
1897- => FormatJson :| fs
1898- => a
1899- -> String
1900- -> String
1901- -> Maybe String
1902- -> Parser (Vary fs )
1903- make format desc flag_ extraHelp =
1904- Opt. flag (Vary. from FormatJson ) (Vary. from format) $
1905- mconcat
1906- [ Opt. help $
1907- " Format "
1908- <> kind
1909- <> " view output to "
1910- <> desc
1911- <> " ."
1912- <> fromMaybe " " extraHelp
1913- , Opt. long (" output-" <> flag_)
1914- ]
1915-
19161837pMaybeOutputFile :: Parser (Maybe (File content Out ))
19171838pMaybeOutputFile =
19181839 optional $
0 commit comments