Store info command help updates

This commit is contained in:
vicky1999 2023-10-17 09:39:59 +05:30
parent 5c65379b22
commit dcc5f801f4
3 changed files with 11 additions and 11 deletions

View file

@ -17,7 +17,7 @@ struct CmdPingStore : StoreCommand, MixJSON
std::string doc() override std::string doc() override
{ {
return return
#include "ping-store.md" #include "store-info.md"
; ;
} }
@ -50,11 +50,11 @@ struct CmdInfoStore : CmdPingStore
{ {
void run(nix::ref<nix::Store> store) override void run(nix::ref<nix::Store> store) override
{ {
warn("'nix store info' is a deprecated alias for 'nix store ping'"); warn("'nix store ping' is a deprecated alias for 'nix store info'");
CmdPingStore::run(store); CmdPingStore::run(store);
} }
}; };
static auto rCmdPingStore = registerCommand2<CmdPingStore>({"store", "ping"}); static auto rCmdPingStore = registerCommand2<CmdPingStore>({"store", "info"});
static auto rCmdInfoStore = registerCommand2<CmdInfoStore>({"store", "info"}); static auto rCmdInfoStore = registerCommand2<CmdInfoStore>({"store", "ping"});

View file

@ -5,19 +5,19 @@ R""(
* Test whether connecting to a remote Nix store via SSH works: * Test whether connecting to a remote Nix store via SSH works:
```console ```console
# nix store ping --store ssh://mac1 # nix store info --store ssh://mac1
``` ```
* Test whether a URL is a valid binary cache: * Test whether a URL is a valid binary cache:
```console ```console
# nix store ping --store https://cache.nixos.org # nix store info --store https://cache.nixos.org
``` ```
* Test whether the Nix daemon is up and running: * Test whether the Nix daemon is up and running:
```console ```console
# nix store ping --store daemon # nix store info --store daemon
``` ```
# Description # Description

View file

@ -1,7 +1,7 @@
source common.sh source common.sh
STORE_INFO=$(nix store ping 2>&1) STORE_INFO=$(nix store info 2>&1)
STORE_INFO_JSON=$(nix store ping --json) STORE_INFO_JSON=$(nix store info --json)
echo "$STORE_INFO" | grep "Store URL: ${NIX_REMOTE}" echo "$STORE_INFO" | grep "Store URL: ${NIX_REMOTE}"
@ -11,7 +11,7 @@ if [[ -v NIX_DAEMON_PACKAGE ]] && isDaemonNewer "2.7.0pre20220126"; then
[[ "$(echo "$STORE_INFO_JSON" | jq -r ".version")" == "$DAEMON_VERSION" ]] [[ "$(echo "$STORE_INFO_JSON" | jq -r ".version")" == "$DAEMON_VERSION" ]]
fi fi
expect 127 NIX_REMOTE=unix:$PWD/store nix store ping || \ expect 127 NIX_REMOTE=unix:$PWD/store nix store info || \
fail "nix store ping on a non-existent store should fail" fail "nix store info on a non-existent store should fail"
[[ "$(echo "$STORE_INFO_JSON" | jq -r ".url")" == "${NIX_REMOTE:-local}" ]] [[ "$(echo "$STORE_INFO_JSON" | jq -r ".url")" == "${NIX_REMOTE:-local}" ]]