mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Styling issues and new class name for the CLI
This commit is contained in:
parent
5ab37de94a
commit
df82e26d5a
@ -17,9 +17,9 @@
|
|||||||
/**
|
/**
|
||||||
* @author Lefteris <lefteris@ethdev.com>
|
* @author Lefteris <lefteris@ethdev.com>
|
||||||
* @date 2014
|
* @date 2014
|
||||||
* Solidity compiler context class.
|
* Solidity command line interface.
|
||||||
*/
|
*/
|
||||||
#include "SolContext.h"
|
#include "CommandLineInterface.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -77,7 +77,6 @@ static inline bool outputToStdout(OutputType type)
|
|||||||
return type == OutputType::STDOUT || type == OutputType::BOTH;
|
return type == OutputType::STDOUT || type == OutputType::BOTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static std::istream& operator>>(std::istream& _in, OutputType& io_output)
|
static std::istream& operator>>(std::istream& _in, OutputType& io_output)
|
||||||
{
|
{
|
||||||
std::string token;
|
std::string token;
|
||||||
@ -93,7 +92,7 @@ static std::istream& operator>>(std::istream& _in, OutputType& io_output)
|
|||||||
return _in;
|
return _in;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolContext::handleBytecode(string const& _argName,
|
void CommandLineInterface::handleBytecode(string const& _argName,
|
||||||
string const& _title,
|
string const& _title,
|
||||||
string const& _contract,
|
string const& _contract,
|
||||||
string const& _suffix)
|
string const& _suffix)
|
||||||
@ -126,7 +125,7 @@ void SolContext::handleBytecode(string const& _argName,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolContext::handleJson(DocumentationType _type,
|
void CommandLineInterface::handleJson(DocumentationType _type,
|
||||||
string const& _contract)
|
string const& _contract)
|
||||||
{
|
{
|
||||||
std::string argName;
|
std::string argName;
|
||||||
@ -172,16 +171,7 @@ void SolContext::handleJson(DocumentationType _type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommandLineInterface::parseArguments(int argc, char** argv)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool SolContext::parseArguments(int argc, char** argv)
|
|
||||||
{
|
{
|
||||||
#define OUTPUT_TYPE_STR "Legal values:\n" \
|
#define OUTPUT_TYPE_STR "Legal values:\n" \
|
||||||
"\tstdout: Print it to standard output\n" \
|
"\tstdout: Print it to standard output\n" \
|
||||||
@ -241,7 +231,7 @@ bool SolContext::parseArguments(int argc, char** argv)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SolContext::processInput()
|
bool CommandLineInterface::processInput()
|
||||||
{
|
{
|
||||||
if (!m_args.count("input-file"))
|
if (!m_args.count("input-file"))
|
||||||
{
|
{
|
||||||
@ -302,7 +292,7 @@ bool SolContext::processInput()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolContext::actOnInput()
|
void CommandLineInterface::actOnInput()
|
||||||
{
|
{
|
||||||
// do we need AST output?
|
// do we need AST output?
|
||||||
if (m_args.count("ast"))
|
if (m_args.count("ast"))
|
@ -17,7 +17,7 @@
|
|||||||
/**
|
/**
|
||||||
* @author Lefteris <lefteris@ethdev.com>
|
* @author Lefteris <lefteris@ethdev.com>
|
||||||
* @date 2014
|
* @date 2014
|
||||||
* Solidity compiler context class.
|
* Solidity command line interface.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ enum class OutputType: uint8_t
|
|||||||
BOTH
|
BOTH
|
||||||
};
|
};
|
||||||
|
|
||||||
class SolContext
|
class CommandLineInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SolContext() {}
|
CommandLineInterface() {}
|
||||||
|
|
||||||
/// Parse command line arguments and return false if we should not continue
|
/// Parse command line arguments and return false if we should not continue
|
||||||
bool parseArguments(int argc, char** argv);
|
bool parseArguments(int argc, char** argv);
|
13
main.cpp
13
main.cpp
@ -20,19 +20,16 @@
|
|||||||
* Solidity commandline compiler.
|
* Solidity commandline compiler.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "CommandLineInterface.h"
|
||||||
#include "SolContext.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
dev::solidity::SolContext ctx;
|
dev::solidity::CommandLineInterface cli;
|
||||||
if (!ctx.parseArguments(argc, argv))
|
if (!cli.parseArguments(argc, argv))
|
||||||
return 1;
|
return 1;
|
||||||
if (!ctx.processInput())
|
if (!cli.processInput())
|
||||||
return 1;
|
return 1;
|
||||||
ctx.actOnInput();
|
cli.actOnInput();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user