diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml deleted file mode 100644 index a6e8b23c5..000000000 --- a/.github/workflows/cli.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: CoreDB CLI workflow - -defaults: - run: - shell: bash - working-directory: ./coredb-cli/ - -on: - pull_request: - branches: - - main - paths: - - '.github/workflows/cli.yml' - - 'coredb-cli/**' - # Always run tests on main or release branches - push: - branches: - - main - - 'release/[0-9]+.[0-9]+' - -jobs: - lint: - name: Run linters - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Install minimal nightly with clippy and rustfmt - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - components: rustfmt, clippy - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: "coredb-cli-lint" - workspaces: | - coredb-cli - - name: Cargo format - run: cargo +nightly fmt --check - - name: Clippy - run: cargo clippy - test: - name: Run tests - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: "coredb-cli-test" - workspaces: | - coredb-cli - - name: Run tests - run: cargo test diff --git a/coredb-cli/.gitignore b/coredb-cli/.gitignore deleted file mode 100644 index 90f043127..000000000 --- a/coredb-cli/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/** diff --git a/coredb-cli/Cargo.lock b/coredb-cli/Cargo.lock deleted file mode 100644 index 873d547e6..000000000 --- a/coredb-cli/Cargo.lock +++ /dev/null @@ -1,634 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - -[[package]] -name = "anstream" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is-terminal", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" - -[[package]] -name = "anstyle-parse" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" -dependencies = [ - "anstyle", - "windows-sys 0.48.0", -] - -[[package]] -name = "assert_cmd" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9834fcc22e0874394a010230586367d4a3e9f11b560f469262678547e1d2575e" -dependencies = [ - "bstr", - "doc-comment", - "predicates", - "predicates-core", - "predicates-tree", - "wait-timeout", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bstr" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b" -dependencies = [ - "memchr", - "once_cell", - "regex-automata", - "serde", -] - -[[package]] -name = "cc" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" - -[[package]] -name = "clap" -version = "4.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ac1f6381d8d82ab4684768f89c0ea3afe66925ceadb4eeb3fc452ffc55d62" -dependencies = [ - "clap_builder", - "clap_derive", - "once_cell", -] - -[[package]] -name = "clap_builder" -version = "4.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84080e799e54cff944f4b4a4b0e71630b0e0443b25b985175c7dddc1a859b749" -dependencies = [ - "anstream", - "anstyle", - "bitflags", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "coredb-cli" -version = "0.3.0" -dependencies = [ - "assert_cmd", - "clap", - "predicates", - "serde_json", - "serde_yaml", -] - -[[package]] -name = "difflib" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "either" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" - -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "float-cmp" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" -dependencies = [ - "num-traits", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" -dependencies = [ - "libc", - "windows-sys 0.42.0", -] - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" - -[[package]] -name = "libc" -version = "0.2.142" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" - -[[package]] -name = "linux-raw-sys" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "normalize-line-endings" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" - -[[package]] -name = "predicates" -version = "2.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" -dependencies = [ - "difflib", - "float-cmp", - "itertools", - "normalize-line-endings", - "predicates-core", - "regex", -] - -[[package]] -name = "predicates-core" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" - -[[package]] -name = "predicates-tree" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" -dependencies = [ - "predicates-core", - "termtree", -] - -[[package]] -name = "proc-macro2" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "regex" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - -[[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "rustix" -version = "0.37.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.45.0", -] - -[[package]] -name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" - -[[package]] -name = "serde_json" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb06d4b6cdaef0e0c51fa881acb721bed3c924cfaa71d9c94a3b771dfdf6567" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "2.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termtree" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" - -[[package]] -name = "unicode-ident" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.1", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" diff --git a/coredb-cli/Cargo.toml b/coredb-cli/Cargo.toml deleted file mode 100644 index 86017c6b9..000000000 --- a/coredb-cli/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "coredb-cli" -version = "0.2.3" -edition = "2021" -authors = ["CoreDB.io"] -description = "The CLI for CoreDB" -homepage = "https://www.coredb.io" -license = "MIT" -readme = "README.md" -repository = "https://github.com/CoreDB-io/coredb/tree/main/coredb-cli" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -clap = { version = "4.2.4", features = ["derive"] } -serde_json = "1.0.91" -serde_yaml = "0.9.17" - -[dev-dependencies] -assert_cmd = "2.0.8" -predicates = "2.1.5" diff --git a/coredb-cli/LICENSE b/coredb-cli/LICENSE deleted file mode 100644 index 4b2871647..000000000 --- a/coredb-cli/LICENSE +++ /dev/null @@ -1,114 +0,0 @@ - CoreDB Community License Agreement - Version 1.0 - -This CoreDB Community License Agreement Version 1.0 (the “Agreement”) sets -forth the terms on which CoreDB, Inc. (“CoreDB”) makes available certain -software made available by CoreDB under this Agreement (the “Software”).   -BY INSTALLING, DOWNLOADING, ACCESSING, USING OR DISTRIBUTING ANY OF THE SOFTWARE, -YOU AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO -SUCH TERMS AND CONDITIONS, YOU MUST NOT USE THE SOFTWARE.  IF YOU ARE RECEIVING -THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE -THE ACTUAL AUTHORITY TO AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT ON -BEHALF OF SUCH ENTITY. “Licensee” means you, an individual, or the entity on -whose behalf you are receiving the Software. - - 1. LICENSE GRANT AND CONDITIONS. - - 1.1 License.  Subject to the terms and conditions of this Agreement, - CoreDB hereby grants to Licensee a non-exclusive, royalty-free, - worldwide, non-transferable, non-sublicenseable license during the term - of this Agreement to: (a) use the Software; (b) prepare modifications and - derivative works of the Software; (c) distribute the Software (including - without limitation in source code or object code form); and (d) reproduce - copies of the Software (the “License”).  Licensee is not granted the - right to, and Licensee shall not, exercise the License for an Excluded - Purpose.  For purposes of this Agreement, “Excluded Purpose” means making - available any software-as-a-service, platform-as-a-service, - infrastructure-as-a-service or other similar online service that competes - with CoreDB products or services that provide the Software. - - 1.2 Conditions.  In consideration of the License, Licensee’s distribution - of the Software is subject to the following conditions: - - (a) Licensee must cause any Software modified by Licensee to carry - prominent notices stating that Licensee modified the Software. - - (b) On each Software copy, Licensee shall reproduce and not remove or - alter all CoreDB or third party copyright or other proprietary - notices contained in the Software, and Licensee must provide the - notice below with each copy.   - - “This software is made available by CoreDB, Inc., under the - terms of the CoreDB Community License Agreement, Version 1.0 - located at http://www.coredb.io/coredb-community-license.  BY - INSTALLING, DOWNLOADING, ACCESSING, USING OR DISTRIBUTING ANY OF - THE SOFTWARE, YOU AGREE TO THE TERMS OF SUCH LICENSE AGREEMENT.” - - 1.3 Licensee Modifications.  Licensee may add its own copyright notices - to modifications made by Licensee and may provide additional or different - license terms and conditions for use, reproduction, or distribution of - Licensee’s modifications.  While redistributing the Software or - modifications thereof, Licensee may choose to offer, for a fee or free of - charge, support, warranty, indemnity, or other obligations. Licensee, and - not CoreDB, will be responsible for any such obligations. - - 1.4 No Sublicensing.  The License does not include the right to - sublicense the Software, however, each recipient to which Licensee - provides the Software may exercise the Licenses so long as such recipient - agrees to the terms and conditions of this Agreement.   - - 2. TERM AND TERMINATION.  This Agreement will continue unless and until - earlier terminated as set forth herein.  If Licensee breaches any of its - conditions or obligations under this Agreement, this Agreement will - terminate automatically and the License will terminate automatically and - permanently. - - 3. INTELLECTUAL PROPERTY.  As between the parties, CoreDB will retain all - right, title, and interest in the Software, and all intellectual property - rights therein. CoreDB hereby reserves all rights not expressly granted - to Licensee in this Agreement. CoreDB hereby reserves all rights in its - trademarks and service marks, and no licenses therein are granted in this - Agreement. - - 4. DISCLAIMER. COREDB HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND - CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY - DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR - PURPOSE, WITH RESPECT TO THE SOFTWARE.   - - 5. LIMITATION OF LIABILITY. COREDB WILL NOT BE LIABLE FOR ANY DAMAGES OF - ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, - SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL - APPLY TO THE EXTENT PERMITTED BY APPLICABLE LAW. - - 6. GENERAL. - - 6.1 Governing Law. This Agreement will be governed by and interpreted in - accordance with the laws of the state of California, without reference to - its conflict of laws principles.  If Licensee is located within the - United States, all disputes arising out of this Agreement are subject to - the exclusive jurisdiction of courts located in Santa Clara County, - California. USA.  If Licensee is located outside of the United States, - any dispute, controversy or claim arising out of or relating to this - Agreement will be referred to and finally determined by arbitration in - accordance with the JAMS International Arbitration Rules.  The tribunal - will consist of one arbitrator. The place of arbitration will be Palo - Alto, California. The language to be used in the arbitrary proceedings - will be English. Judgment upon the award rendered by the arbitrator may - be entered in any court having jurisdiction thereof. - - 6.2 Assignment.  Licensee is not authorized to assign its rights under - this Agreement to any third party. CoreDB may freely assign its rights - under this Agreement to any third party. - - 6.3 Other.  This Agreement is the entire agreement between the parties - regarding the subject matter hereof.  No amendment or modification of - this Agreement will be valid or binding upon the parties unless made in - writing and signed by the duly authorized representatives of both - parties.  In the event that any provision, including without limitation - any condition, of this Agreement is held to be unenforceable, this - Agreement and all licenses and rights granted hereunder will immediately - terminate.  Waiver by CoreDB of a breach of any provision of this - Agreement or the failure by CoreDB to exercise any right hereunder - will not be construed as a waiver of any subsequent breach of that right - or as a waiver of any other right. \ No newline at end of file diff --git a/coredb-cli/README.md b/coredb-cli/README.md deleted file mode 100644 index 1fbd5124d..000000000 --- a/coredb-cli/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# CoreDB CLI - -Work in progress CLI diff --git a/coredb-cli/src/commands/create.rs b/coredb-cli/src/commands/create.rs deleted file mode 100644 index 84c582e27..000000000 --- a/coredb-cli/src/commands/create.rs +++ /dev/null @@ -1,76 +0,0 @@ -use super::{ResourceType, SubCommand}; -use clap::Args; -use serde_json::json; -use serde_yaml; -use std::io::Write; -use std::process::{Command, Stdio}; - -#[derive(Args)] -pub struct CreateCommand { - resource_type: ResourceType, - name: String, - #[arg(long = "dry-run")] - dry_run: bool, -} - -fn generate_yaml(resource_type: ResourceType, name: String) -> String { - match resource_type { - ResourceType::Db | ResourceType::Dbs => { - let json_value = json!({ - "apiVersion": "coredb.io/v1alpha1", - "kind": "CoreDB", - "metadata": { - "name": name, - "namespace": "default", - }, - "spec": { - "replicas": 1, - }, - }); - serde_yaml::to_string(&json_value).unwrap() - } - } -} - -impl SubCommand for CreateCommand { - fn execute(&self) { - match self.resource_type { - ResourceType::Db | ResourceType::Dbs => { - if self.dry_run { - println!( - "{}", - generate_yaml(self.resource_type.clone(), self.name.clone()) - ); - } else { - println!("Creating a new db with name: {}", self.name); - - let mut kubectl = Command::new("kubectl") - .arg("apply") - .arg("-f") - .arg("-") - .stdin(Stdio::piped()) - .spawn() - .expect("Failed to spawn kubectl process"); - - // Write the YAML string to the command's stdin - if let Some(ref mut stdin) = kubectl.stdin { - stdin - .write_all( - generate_yaml(self.resource_type.clone(), self.name.clone()) - .as_bytes(), - ) - .expect("Failed to write to kubectl stdin"); - } - - // Wait for the command to finish and check its exit status - let status = kubectl.wait().expect("Failed to wait on kubectl"); - - if !status.success() { - eprintln!("kubectl apply failed with status {:?}", status); - eprintln!("\n\nHint: Is CoreDB installed in the cluster?\n\nTry running 'coredb install'"); - } - } - } - } - } -} diff --git a/coredb-cli/src/commands/get.rs b/coredb-cli/src/commands/get.rs deleted file mode 100644 index 3a49ced63..000000000 --- a/coredb-cli/src/commands/get.rs +++ /dev/null @@ -1,25 +0,0 @@ -use super::{ResourceType, SubCommand}; -use clap::Args; -use std::process::Command; - -#[derive(Args)] -pub struct GetCommand { - #[arg(value_enum)] - resource_type: ResourceType, -} - -impl SubCommand for GetCommand { - fn execute(&self) { - match self.resource_type { - ResourceType::Db | ResourceType::Dbs => { - let output = Command::new("kubectl") - .arg("get") - .arg("coredbs") - .arg("--all-namespaces") - .output() - .expect("Failed to execute 'kubectl' command."); - println!("{}", String::from_utf8_lossy(&output.stdout)); - } - } - } -} diff --git a/coredb-cli/src/commands/install.rs b/coredb-cli/src/commands/install.rs deleted file mode 100644 index ec229615c..000000000 --- a/coredb-cli/src/commands/install.rs +++ /dev/null @@ -1,32 +0,0 @@ -use super::SubCommand; -use clap::Args; -use std::process::Command; - -#[derive(Args)] -pub struct InstallCommand { - #[arg(short = 'b', long = "branch", default_value = "main")] - branch: String, -} - -impl SubCommand for InstallCommand { - fn execute(&self) { - let output = Command::new("kubectl") - .arg("apply") - .arg("-f") - .arg( - format!("https://raw.githubusercontent.com/CoreDB-io/coredb/{}/coredb-operator/charts/coredb-operator/templates/crd.yaml", self.branch) - ) - .output() - .expect("Failed to execute 'kubectl' command."); - println!("{}", String::from_utf8_lossy(&output.stdout)); - let output = Command::new("kubectl") - .arg("apply") - .arg("-f") - .arg( - format!("https://raw.githubusercontent.com/CoreDB-io/coredb/{}/coredb-operator/yaml/install.yaml", self.branch) - ) - .output() - .expect("Failed to execute 'kubectl' command."); - println!("{}", String::from_utf8_lossy(&output.stdout)); - } -} diff --git a/coredb-cli/src/commands/mod.rs b/coredb-cli/src/commands/mod.rs deleted file mode 100644 index e1cb1df2b..000000000 --- a/coredb-cli/src/commands/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub mod create; -pub mod get; -pub mod install; -use clap::ValueEnum; - -#[derive(ValueEnum, Clone)] -enum ResourceType { - Db, - Dbs, -} - -pub trait SubCommand { - fn execute(&self); -} diff --git a/coredb-cli/src/main.rs b/coredb-cli/src/main.rs deleted file mode 100644 index 66d3c5b14..000000000 --- a/coredb-cli/src/main.rs +++ /dev/null @@ -1,34 +0,0 @@ -mod commands; - -use crate::commands::SubCommand; -use clap::{Parser, Subcommand}; - -#[derive(Parser)] -#[command(author, version, about, long_about = None)] -#[command(propagate_version = true)] -struct Cli { - #[command(subcommand)] - command: SubCommands, -} - -#[derive(Subcommand)] -enum SubCommands { - Get(commands::get::GetCommand), - Create(commands::create::CreateCommand), - Install(commands::install::InstallCommand), -} - -impl SubCommand for SubCommands { - fn execute(&self) { - match self { - SubCommands::Get(cmd) => cmd.execute(), - SubCommands::Create(cmd) => cmd.execute(), - SubCommands::Install(cmd) => cmd.execute(), - } - } -} - -fn main() { - let cli = Cli::parse(); - cli.command.execute(); -} diff --git a/coredb-cli/tests/integration_tests.rs b/coredb-cli/tests/integration_tests.rs deleted file mode 100644 index 9fab658d6..000000000 --- a/coredb-cli/tests/integration_tests.rs +++ /dev/null @@ -1,44 +0,0 @@ -use assert_cmd::prelude::*; // Add methods on commands -use predicates::prelude::*; // Used for writing assertions -use std::process::Command; // Run programs - -const CARGO_BIN: &str = "coredb-cli"; - -#[test] -fn help() -> Result<(), Box> { - let mut cmd = Command::cargo_bin(CARGO_BIN)?; - - cmd.arg("--help"); - cmd.assert().stdout(predicate::str::contains("Usage: ")); - - Ok(()) -} - -#[test] -fn create_dry_run() -> Result<(), Box> { - let mut cmd = Command::cargo_bin(CARGO_BIN)?; - cmd.arg("create") - .arg("db") - .arg("--dry-run") - .arg("sample-db"); - cmd.assert() - .stdout(predicate::str::contains("kind: CoreDB")); - - let mut cmd = Command::cargo_bin(CARGO_BIN)?; - cmd.arg("create") - .arg("--dry-run") - .arg("db") - .arg("sample-db"); - cmd.assert() - .stdout(predicate::str::contains("kind: CoreDB")); - - let mut cmd = Command::cargo_bin(CARGO_BIN)?; - cmd.arg("create") - .arg("db") - .arg("sample-db") - .arg("--dry-run"); - cmd.assert() - .stdout(predicate::str::contains("kind: CoreDB")); - - Ok(()) -}