Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2] Build framework for leap-util #150

Merged
merged 24 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d961205
Scaffold, putting cli11 subcommands in separate files
vladtr Aug 23, 2022
97c1980
Added autocompletion for bash
vladtr Aug 25, 2022
54b7eac
+=blocklog, initial raw port
vladtr Sep 7, 2022
1a0d3ef
+=actions_blocklog
vladtr Sep 7, 2022
8bc0826
remove accidental clang-format checkin lol
vladtr Sep 7, 2022
6096916
Define cli option for displaying lots of help
vladtr Sep 7, 2022
48d55ef
Added boilerplate for snapshot subcommand
vladtr Sep 8, 2022
613627f
Added handling of return code
vladtr Sep 12, 2022
45e33e5
Moved cli11 in interface only lib, adjusted cleos and leap-util to us…
vladtr Sep 14, 2022
4829bcf
Added bash-complete scripts for both leap-util and cleos
vladtr Sep 14, 2022
acc1a62
Simplified makefile
vladtr Sep 14, 2022
134c448
Linting and cleanup
vladtr Sep 14, 2022
75ffc6b
Updated CLI11 header to the latest
vladtr Sep 19, 2022
08e0f22
Added chain subcomand, refactoring, bugfixes
vladtr Sep 20, 2022
e592a4a
Multiple changes
vladtr Sep 23, 2022
511f6db
Removet leftovers of genesis from chain-state sc
vladtr Sep 23, 2022
57cbae4
Added bash-completions configs to leap-util and cleos
vladtr Sep 26, 2022
90ce207
Addressing feedback, part one
vladtr Sep 30, 2022
bb462ef
Replaced hardcoded leap-util name with var
vladtr Sep 30, 2022
d198de9
Ditched ilog, added constraints
vladtr Sep 30, 2022
efd9534
Cleaned-up some of block-log stuff
vladtr Sep 30, 2022
294fa45
+=constraint for sc
vladtr Sep 30, 2022
94749d1
install path fix
vladtr Sep 30, 2022
94bee32
Initialize all subcommands flags to false
vladtr Oct 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ endif()
set( CLI_CLIENT_EXECUTABLE_NAME cleos )
set( NODE_EXECUTABLE_NAME nodeos )
set( KEY_STORE_EXECUTABLE_NAME keosd )
set( LEAP_UTIL_EXECUTABLE_NAME leap-util )

# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Expand Down Expand Up @@ -244,6 +245,14 @@ install(FILES libraries/yubihsm/LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROO
install(FILES libraries/eos-vm/LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/leap/ RENAME LICENSE.eos-vm COMPONENT base)
install(FILES libraries/fc/libraries/ff/LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/leap/ RENAME LICENSE.libff COMPONENT base)

configure_file(${CMAKE_SOURCE_DIR}/libraries/cli11/bash-completion/completions/leap-util
${CMAKE_BINARY_DIR}/programs/leap-util/bash-completion/completions/leap-util COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/libraries/cli11/bash-completion/completions/cleos
${CMAKE_BINARY_DIR}/programs/cleos/bash-completion/completions/cleos COPYONLY)

install(FILES libraries/cli11/bash-completion/completions/leap-util DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/bash-completion/completions COMPONENT base)
install(FILES libraries/cli11/bash-completion/completions/cleos DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/bash-completion/completions COMPONENT base)

add_custom_target(dev-install
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}"
Expand Down
1 change: 1 addition & 0 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ add_subdirectory( chain )
add_subdirectory( testing )
add_subdirectory( version )
add_subdirectory( state_history )
add_subdirectory( cli11 )

set(USE_EXISTING_SOFTFLOAT ON CACHE BOOL "use pre-exisiting softfloat lib")
set(ENABLE_TOOLS OFF CACHE BOOL "Build tools")
Expand Down
2 changes: 2 additions & 0 deletions libraries/cli11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_library(leap-cli11 INTERFACE)
target_include_directories(leap-cli11 INTERFACE include)
26 changes: 26 additions & 0 deletions libraries/cli11/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

## instructions for building custom leap-cli11 library

leap-cli11 interface only library created in order to simplify integration of modified version of command line parsing library cli11

to update included in this library include/cli11/CLI11.hpp file it needs to be (re)geenerated from repository containing forked/modified version of it, in particular:


```bash
git clone https://github.com/AntelopeIO/CLI11.git
cd CLI11
mkdir build
cd build
cmake -DCLI11_SINGLE_FILE=ON ..
make -j
```

Resulting single-header will be located in:

```cpp
build/include/CLI11.hpp
```

And is ready to be copied to include/cli11/CLI11.hpp of leap-cli11 library

Automated CLI11 subproject build / import of CLI11.hpp header will be added in future versions.
26 changes: 26 additions & 0 deletions libraries/cli11/bash-completion/completions/cleos
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#/usr/bin/env bash

_cleos_complete()
{
# Get cmdline while ignoring the last word
cmdline=${COMP_LINE}
if [[ "${cmdline:(-1)}" != " " ]]; then
cmdline=${COMP_WORDS[@]:0:${COMP_CWORD}}
fi

# Get complete candidates
words=$(${cmdline} --_autocomplete "${COMP_WORDS[${COMP_CWORD}]}")

# Remove candidates that begins with `-` if `-` is not passed as the first character
# TODO: move this logic inside CLI11? including the compgen?
if [[ ! ${COMP_WORDS[${COMP_CWORD}]} = -* ]]; then
words=(${words})
for index in "${!words[@]}" ; do [[ ${words[$index]} =~ ^- ]] && unset -v 'words[$index]' ; done
words="${words[@]}"
fi

# Get matches
COMPREPLY=($(compgen -W "${words}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
}

complete -F _cleos_complete cleos
26 changes: 26 additions & 0 deletions libraries/cli11/bash-completion/completions/leap-util
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#/usr/bin/env bash

_leap_complete()
{
# Get cmdline while ignoring the last word
cmdline=${COMP_LINE}
if [[ "${cmdline:(-1)}" != " " ]]; then
cmdline=${COMP_WORDS[@]:0:${COMP_CWORD}}
fi

# Get complete candidates
words=$(${cmdline} --_autocomplete "${COMP_WORDS[${COMP_CWORD}]}")

# Remove candidates that begins with `-` if `-` is not passed as the first character
# TODO: move this logic inside CLI11? including the compgen?
if [[ ! ${COMP_WORDS[${COMP_CWORD}]} = -* ]]; then
words=(${words})
for index in "${!words[@]}" ; do [[ ${words[$index]} =~ ^- ]] && unset -v 'words[$index]' ; done
words="${words[@]}"
fi

# Get matches
COMPREPLY=($(compgen -W "${words}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
}

complete -F _leap_complete leap-util
Loading