Repository: atuinsh/atuin (language: rust)

Issue:
Proposal: `atuin config` should list all config files and dirs
When writing documentation, it would be nice to tell people that they can run `atuin config` to get the locations of their config file, key file, and other important configuration locations and information.

This is in the spirit of ["Everything that uses configuration files should report where they're located"](https://utcc.utoronto.ca/~cks/space/blog/sysadmin/ReportConfigFileLocations).

Some examples from other commands:
<details><summary>brew config</summary>

```
$ brew config
HOMEBREW_VERSION: 4.2.2-12-g0555270
ORIGIN: https://github.com/Homebrew/brew
HEAD: 055527086789d315ac20253966bc4afce373499c
Last commit: 7 days ago
Core tap HEAD: 13fda40c2e56386c3c969fc1bc0e186095228dc7
Core tap last commit: 3 weeks ago
Core tap JSON: 03 Jan 14:57 UTC
Core cask tap HEAD: eb0b3ca130c206fea3f2c94e89393c6608f9a02a
Core cask tap last commit: 3 weeks ago
Core cask tap JSON: 03 Jan 14:57 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_BAT_THEME: ansi
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: /opt/homebrew/bin/nvim
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.43.0 => /opt/homebrew/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.2.1-arm64
CLT: 15.1.0.0.1.1700200546
Xcode: 15.2
Rosetta 2: false
```

</details>

<details><summary>redis-cli INFO</summary>

```
# Server
redis_version:7.2.3
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:96f23777753ded6c
redis_mode:standalone
os:Darwin 23.2.0 arm64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:kqueue
atomicvar_api:c11-builtin
gcc_version:4.2.1
process_id:69512
process_supervised:no
run_id:81cb2362298263eb73ca70ef8d63d2be7d75670f
tcp_port:6379
server_time_usec:1704903236777843
uptime_in_seconds:14
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:10404420
executable:/opt/homebrew/opt/redis/bin/redis-server
config_file:/opt/homebrew/etc/redis.conf
io_threads_active:0
listener0:name=tcp,bind=127.0.0.1,bind=::1,port=6379

# Clients
connected_clients:1
cluster_connections:0
maxclients:10000
client_recent_max_input_buffer:0
client_recent_max_output_buffer:0
blocked_clients:0
tracking_clients:0
clients_in_timeout_table:0
total_blocking_keys:0
total_blocking_keys_on_nokey:0

# Memory
used_memory:1161184
used_memory_human:1.11M
used_memory_rss:6455296
used_memory_rss_human:6.16M
used_memory_peak:1161184
used_memory_peak_human:1.11M
used_memory_peak_perc:100.00%
used_memory_overhead:1099208
used_memory_startup:1098992
used_memory_dataset:61976
used_memory_dataset_perc:99.65%
allocator_allocated:1124560
allocator_active:6423552
allocator_resident:6423552
total_system_memory:34359738368
total_system_memory_human:32.00G
used_memory_lua:31744
used_memory_vm_eval:31744
used_memory_lua_human:31.00K
used_memory_scripts_eval:0
number_of_cached_scripts:0
number_of_functions:0
number_of_libraries:0
used_memory_vm_functions:32768
used_memory_vm_total:64512
used_memory_vm_total_human:63.00K
used_memory_functions:216
used_memory_scripts:216
used_memory_scripts_human:216B
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:5.71
allocator_frag_bytes:5298992
allocator_rss_ratio:1.00
allocator_rss_bytes:0
rss_overhead_ratio:1.00
rss_overhead_bytes:31744
mem_fragmentation_ratio:5.74
mem_fragmentation_bytes:5330736
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_total_replication_buffers:0
mem_clients_slaves:0
mem_clients_normal:0
mem_cluster_links:0
mem_aof_buffer:0
mem_allocator:libc
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:0

# Persistence
loading:0
async_loading:0
current_cow_peak:0
current_cow_size:0
current_cow_size_age:0
current_fork_perc:0.00
current_save_keys_processed:0
current_save_keys_total:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1704903222
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_saves:0
rdb_last_cow_size:0
rdb_last_load_keys_expired:0
rdb_last_load_keys_loaded:0
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_rewrites:0
aof_rewrites_consecutive_failures:0
aof_last_write_status:ok
aof_last_cow_size:0
module_fork_in_progress:0
module_fork_last_cow_size:0

# Stats
total_connections_received:3
total_commands_processed:2
instantaneous_ops_per_sec:0
total_net_input_bytes:42
total_net_output_bytes:10432
total_net_repl_input_bytes:0
total_net_repl_output_bytes:0
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
instantaneous_input_repl_kbps:0.00
instantaneous_output_repl_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
expired_stale_perc:0.00
expired_time_cap_reached_count:0
expire_cycle_cpu_milliseconds:0
evicted_keys:0
evicted_clients:0
total_eviction_exceeded_time:0
current_eviction_exceeded_time:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
pubsubshard_channels:0
latest_fork_usec:0
total_forks:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
total_active_defrag_time:0
current_active_defrag_time:0
tracking_total_keys:0
tracking_total_items:0
tracking_total_prefixes:0
unexpected_error_replies:0
total_error_replies:0
dump_payload_sanitizations:0
total_reads_processed:5
total_writes_processed:2
io_threaded_reads_processed:0
io_threaded_writes_processed:0
reply_buffer_shrinks:0
reply_buffer_expands:0
eventloop_cycles:145
eventloop_duration_sum:53917
eventloop_duration_cmd_sum:325
instantaneous_eventloop_cycles_per_sec:9
instantaneous_eventloop_duration_usec:167
acl_access_denied_auth:0
acl_access_denied_cmd:0
acl_access_denied_key:0
acl_access_denied_channel:0

# Replication
role:master
connected_slaves:0
master_failover_state:no-failover
master_replid:1ea297a9fced698cb421c39779f946e8d1bbf1d6
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:0.024833
used_cpu_user:0.021988
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000

# Modules

# Errorstats

# Cluster
cluster_enabled:0

# Keyspace
```

</details>

<details><summary>go env</summary>

```
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN='/Users/llimllib/go/bin'
GOCACHE='/Users/llimllib/Library/Caches/go-build'
GOENV='/Users/llimllib/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/llimllib/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/llimllib/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/llimllib/.local/share/asdf/installs/golang/1.21.1/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/llimllib/.local/share/asdf/installs/golang/1.21.1/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.1'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/cj/3fpctnd52vv37y9gpdgg7c200000gn/T/go-build1348807819=/tmp/go-build -gno-record-gcc-switches -fno-common'
```

</details>

<details><summary>pip config list -v</summary>

```
$ pip config list -v
For variant 'global', will try loading '/Library/Application Support/pip/pip.conf'
For variant 'user', will try loading '/Users/llimllib/.pip/pip.conf'
For variant 'user', will try loading '/Users/llimllib/.config/pip/pip.conf'
For variant 'site', will try loading '/Users/llimllib/.local/share/asdf/installs/python/3.10.12/pip.conf'
```

</details>

It would be cool if `atuin` would print its entire configuration nicely like redis, but also would be an improvement if it would just tell the user that their config file is in `~/.config/atuin/config.toml`, their key in `~/.local/share/atuin/key`, and any other important file locations.


Discussion / hints:
This issue has been mentioned on **Atuin Community**. There might be relevant details there:

https://forum.atuin.sh/t/feature-idea-taggable-environments-to-group-shell-commands/76/10

Thank you for the suggestion! Totally makes sense.

I'd prefer we use `atuin info` or similar, as I'd like to use `atuin config` for other things
This issue has been mentioned on **Atuin Community**. There might be relevant details there:

https://forum.atuin.sh/t/18-0-0-feedback/150/3


Fix patch:
diff --git a/atuin/src/command/client.rs b/atuin/src/command/client.rs
index 732df7ff3ba..ccd554bfa99 100644
--- a/atuin/src/command/client.rs
+++ b/atuin/src/command/client.rs
@@ -17,6 +17,7 @@ mod doctor;
 mod dotfiles;
 mod history;
 mod import;
+mod info;
 mod init;
 mod kv;
 mod search;
@@ -59,6 +60,10 @@ pub enum Cmd {
     #[command()]
     Init(init::Cmd),
 
+    /// Information about dotfiles locations and ENV vars
+    #[command()]
+    Info,
+
     #[command()]
     Doctor,
 
@@ -117,6 +122,11 @@ impl Cmd {
 
             Self::Init(init) => init.run(&settings).await,
 
+            Self::Info => {
+                info::run(&settings);
+                Ok(())
+            }
+
             Self::Doctor => doctor::run(&settings),
 
             Self::DefaultConfig => {
diff --git a/atuin/src/command/client/info.rs b/atuin/src/command/client/info.rs
new file mode 100644
index 00000000000..60ba1fe67dd
--- /dev/null
+++ b/atuin/src/command/client/info.rs
@@ -0,0 +1,31 @@
+use atuin_client::settings::Settings;
+
+use crate::VERSION;
+
+pub fn run(settings: &Settings) {
+    let config = atuin_common::utils::config_dir();
+    let mut config_file = config.clone();
+    config_file.push("config.toml");
+    let mut sever_config = config;
+    sever_config.push("server.toml");
+
+    let config_paths = format!(
+        "Config files:\nclient config: {:?}\nserver config: {:?}\nclient db path: {:?}\nkey path: {:?}\nsession path: {:?}",
+        config_file.to_string_lossy(),
+        sever_config.to_string_lossy(),
+        settings.db_path,
+        settings.key_path,
+        settings.session_path
+    );
+
+    let env_vars = format!(
+        "Env Vars:\nATUIN_CONFIG_DIR = {:?}",
+        std::env::var("ATUIN_CONFIG_DIR").unwrap_or_else(|_| "None".into())
+    );
+
+    let general_info = format!("Version info:\nversion: {VERSION}");
+
+    let print_out = format!("{config_paths}\n\n{env_vars}\n\n{general_info}");
+
+    println!("{print_out}");
+}


Test patch: