mirror of
https://github.com/Cameron-Reed1/Cpp-Argument-Parser.git
synced 2025-01-10 15:56:47 +00:00
Fix whitespace
This commit is contained in:
parent
1449f7e47c
commit
085236fb62
@ -6,13 +6,13 @@ namespace Arguments
|
|||||||
{
|
{
|
||||||
|
|
||||||
enum ERROR {
|
enum ERROR {
|
||||||
NO_ERROR = 0,
|
NO_ERROR = 0,
|
||||||
|
|
||||||
ERROR_UNKNOWN_ARGUMENT,
|
ERROR_UNKNOWN_ARGUMENT,
|
||||||
ERROR_UNKNOWN_POSITIONAL_ARGUMENT,
|
ERROR_UNKNOWN_POSITIONAL_ARGUMENT,
|
||||||
|
|
||||||
ERROR_MISSING_VALUE,
|
ERROR_MISSING_VALUE,
|
||||||
ERROR_MISSING_POSITIONAL_ARGUMENT,
|
ERROR_MISSING_POSITIONAL_ARGUMENT,
|
||||||
|
|
||||||
ERROR_INVALID_INT,
|
ERROR_INVALID_INT,
|
||||||
};
|
};
|
||||||
|
38
Makefile
38
Makefile
@ -45,59 +45,59 @@ all: $(BUILD_DIR)/$(LIB_FILE_NAME)
|
|||||||
|
|
||||||
ifneq ($(TYPE), $(SHARED_TYPE))
|
ifneq ($(TYPE), $(SHARED_TYPE))
|
||||||
shared: clean
|
shared: clean
|
||||||
@sed -i -e "s/^TYPE = .*$$/TYPE = $(SHARED_TYPE)/" Makefile
|
@sed -i -e "s/^TYPE = .*$$/TYPE = $(SHARED_TYPE)/" Makefile
|
||||||
|
|
||||||
.PHONY: shared
|
.PHONY: shared
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(TYPE), $(STATIC_TYPE))
|
ifneq ($(TYPE), $(STATIC_TYPE))
|
||||||
static: clean
|
static: clean
|
||||||
@sed -i -e "s/^TYPE = .*$$/TYPE = $(STATIC_TYPE)/" Makefile
|
@sed -i -e "s/^TYPE = .*$$/TYPE = $(STATIC_TYPE)/" Makefile
|
||||||
|
|
||||||
.PHONY: static
|
.PHONY: static
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(BUILD_DIR)/$(LIB_FILE_NAME): $(OBJECTS)
|
$(BUILD_DIR)/$(LIB_FILE_NAME): $(OBJECTS)
|
||||||
ifeq ($(TYPE), $(SHARED_TYPE))
|
ifeq ($(TYPE), $(SHARED_TYPE))
|
||||||
$(CXX) $^ $(CXXFLAGS) -shared -o $@
|
$(CXX) $^ $(CXXFLAGS) -shared -o $@
|
||||||
else
|
else
|
||||||
$(AR) $(ARFLAGS) $@ $^
|
$(AR) $(ARFLAGS) $@ $^
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c | $(BUILD_DIR)
|
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c | $(BUILD_DIR)
|
||||||
$(CC) -c $< $(CFLAGS) -o $@
|
$(CC) -c $< $(CFLAGS) -o $@
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp | $(BUILD_DIR)
|
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp | $(BUILD_DIR)
|
||||||
$(CXX) -c $< $(CXXFLAGS) -o $@
|
$(CXX) -c $< $(CXXFLAGS) -o $@
|
||||||
|
|
||||||
$(BUILD_DIR):
|
$(BUILD_DIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
test: test.cpp all | $(BUILD_DIR)
|
test: test.cpp all | $(BUILD_DIR)
|
||||||
$(CXX) $< $(CXXFLAGS) -l$(LIB_NAME) -L$(BUILD_DIR) $(TESTFLAGS) -o $(BUILD_DIR)/test
|
$(CXX) $< $(CXXFLAGS) -l$(LIB_NAME) -L$(BUILD_DIR) $(TESTFLAGS) -o $(BUILD_DIR)/test
|
||||||
-$(BUILD_DIR)/test
|
-$(BUILD_DIR)/test
|
||||||
|
|
||||||
test_installed: test.cpp | $(BUILD_DIR)
|
test_installed: test.cpp | $(BUILD_DIR)
|
||||||
$(CXX) $< $(CXXFLAGS) -l$(LIB_NAME) -o $(BUILD_DIR)/test
|
$(CXX) $< $(CXXFLAGS) -l$(LIB_NAME) -o $(BUILD_DIR)/test
|
||||||
-$(BUILD_DIR)/test
|
-$(BUILD_DIR)/test
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
cp $(BUILD_DIR)/$(LIB_FILE_NAME) $(INSTALL_DIR)
|
cp $(BUILD_DIR)/$(LIB_FILE_NAME) $(INSTALL_DIR)
|
||||||
cp $(HEADERS) $(HEADER_INSTALL_DIR)
|
cp $(HEADERS) $(HEADER_INSTALL_DIR)
|
||||||
@chmod 0755 $(INSTALL_DIR)/$(LIB_FILE_NAME)
|
@chmod 0755 $(INSTALL_DIR)/$(LIB_FILE_NAME)
|
||||||
ifeq ($(TYPE), $(SHARED_TYPE))
|
ifeq ($(TYPE), $(SHARED_TYPE))
|
||||||
@ldconfig
|
@ldconfig
|
||||||
endif
|
endif
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(RM) $(INSTALL_DIR)/$(LIB_FILE_NAME)
|
$(RM) $(INSTALL_DIR)/$(LIB_FILE_NAME)
|
||||||
$(RM) $(addprefix $(HEADER_INSTALL_DIR)/, $(notdir $(HEADERS)))
|
$(RM) $(addprefix $(HEADER_INSTALL_DIR)/, $(notdir $(HEADERS)))
|
||||||
ifeq ($(TYPE), $(SHARED_TYPE))
|
ifeq ($(TYPE), $(SHARED_TYPE))
|
||||||
@ldconfig
|
@ldconfig
|
||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -r $(BUILD_DIR)
|
$(RM) -r $(BUILD_DIR)
|
||||||
|
|
||||||
.PHONY: all test install uninstall clean
|
.PHONY: all test install uninstall clean
|
||||||
|
|
||||||
|
36
test.cpp
36
test.cpp
@ -7,31 +7,31 @@ int main(int argc, char** argv) {
|
|||||||
Arguments::String first('f', "none");
|
Arguments::String first('f', "none");
|
||||||
first.alias("first");
|
first.alias("first");
|
||||||
|
|
||||||
Arguments::Int second("second", 0);
|
Arguments::Int second("second", 0);
|
||||||
second.alias('s');
|
second.alias('s');
|
||||||
|
|
||||||
Arguments::Bool third("third");
|
Arguments::Bool third("third");
|
||||||
third.alias("abc").alias('t');
|
third.alias("abc").alias('t');
|
||||||
|
|
||||||
Arguments::PositionalString name("", true);
|
Arguments::PositionalString name("", true);
|
||||||
Arguments::PositionalInt age(0, false);
|
Arguments::PositionalInt age(0, false);
|
||||||
|
|
||||||
if (Arguments::parse(argc, argv) != Arguments::NO_ERROR) {
|
if (Arguments::parse(argc, argv) != Arguments::NO_ERROR) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Found:" << std::endl;
|
std::cout << "Found:" << std::endl;
|
||||||
std::cout << "\tFirst: " << first.found << std::endl;
|
std::cout << "\tFirst: " << first.found << std::endl;
|
||||||
std::cout << "\tSecond: " << second.found << std::endl;
|
std::cout << "\tSecond: " << second.found << std::endl;
|
||||||
std::cout << "\tThird: " << third.found << std::endl;
|
std::cout << "\tThird: " << third.found << std::endl;
|
||||||
std::cout << "\tName: " << name.found << std::endl;
|
std::cout << "\tName: " << name.found << std::endl;
|
||||||
std::cout << "\tAge: " << age.found << std::endl;
|
std::cout << "\tAge: " << age.found << std::endl;
|
||||||
|
|
||||||
std::cout << std::endl << "Values:" << std::endl;
|
std::cout << std::endl << "Values:" << std::endl;
|
||||||
std::cout << "\tFirst: " << first.value << std::endl;
|
std::cout << "\tFirst: " << first.value << std::endl;
|
||||||
std::cout << "\tSecond: " << second.value << std::endl;
|
std::cout << "\tSecond: " << second.value << std::endl;
|
||||||
std::cout << "\tName: " << name.value << std::endl;
|
std::cout << "\tName: " << name.value << std::endl;
|
||||||
std::cout << "\tAge: " << age.value << std::endl;
|
std::cout << "\tAge: " << age.value << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user