mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
|
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Check / lint (push) Has been cancelled
Docker Check / build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / unit-tests (push) Has been cancelled
Go Test / cli-tests (push) Has been cancelled
Go Test / example-tests (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
* Implements the -l/--long flag for the ipfs ls command to display Unix-style file permissions and modification times, similar to the traditional ls -l. When the --long flag is used, the output includes: - File mode/permissions in Unix format (e.g., -rw-r--r--, drwxr-xr-x) - File hash (CID) - File size (when --size is also specified) - Modification time in human-readable format - File name The permission string implementation handles all file types and special bits: - File types: regular (-), directory (d), symlink (l), named pipe (p), socket (s), character device (c), block device (b) - Special permission bits: setuid (s/S), setgid (s/S), sticky (t/T) - Lowercase when execute bit is set, uppercase when not set The timestamp format follows Unix ls conventions: - Recent files (within 6 months): "Jan 02 15:04" - Older files: "Jan 02 2006" Signed-off-by: sneax <paladesh600@gmail.com> * fix(ls): correct --long flag header order and help text - fix header column order: was "Mode Hash Size Name ModTime" but data outputs "Mode Hash Size ModTime Name", now headers match data order - remove redundant if/else branch in directory output that had identical code in both branches - add example output to help text showing format with mode, hash, size, mtime, and name columns - document that files without preserved metadata show '----------' for mode and '-' for mtime - add changelog entry for v0.40 * test(ls): add format stability tests for --long flag add tests to prevent formatting regressions in ipfs ls --long output: unit tests (core/commands/ls_test.go): - TestFormatMode: 20 cases covering all file types (regular, dir, symlink, pipe, socket, block/char devices) and special permission bits (setuid, setgid, sticky with/without execute) - TestFormatModTime: zero time, old time (year format), future time, format length consistency integration tests (test/cli/ls_test.go): - explicit full output comparison with deterministic CIDs to catch any formatting changes - header column order verification for --long with --size=true/false - files without preserved metadata (---------- and - placeholders) - directory output (trailing slash, d prefix in mode) requested in: https://github.com/ipfs/kubo/pull/11103#issuecomment-3745043561 * fix(ls): improve --long flag docs and fix minor issues - improved godocs for formatMode and formatModTime functions - fixed permBit signature: char rune → char byte (avoids unnecessary cast) - clarified help text: mode/mtime are optional UnixFS metadata - documented that times are displayed in UTC - fixed flaky time test by using 1 month ago instead of 1 hour - removed hardcoded CID assertion that would break on DAG changes * fix(ls): show "-" for missing mode in --long output display "-" instead of "----------" when mode metadata is not preserved. this avoids ambiguity with Unix mode 0000 and matches how missing mtime is already displayed. follows common Unix tool conventions (ps, netstat) where "-" indicates "not available". --------- Signed-off-by: sneax <paladesh600@gmail.com> Co-authored-by: Marcin Rataj <lidel@lidel.org> |
||
|---|---|---|
| .. | ||
| autoconf | ||
| fixtures | ||
| harness | ||
| migrations | ||
| testutils | ||
| add_test.go | ||
| agent_version_unicode_test.go | ||
| api_file_test.go | ||
| backup_bootstrap_test.go | ||
| basic_commands_test.go | ||
| bitswap_config_test.go | ||
| bootstrap_auto_test.go | ||
| cid_test.go | ||
| cli_https_test.go | ||
| commands_without_repo_test.go | ||
| completion_test.go | ||
| config_secrets_test.go | ||
| content_blocking_test.go | ||
| content_routing_http_test.go | ||
| daemon_test.go | ||
| dag_test.go | ||
| delegated_routing_v1_http_client_test.go | ||
| delegated_routing_v1_http_proxy_test.go | ||
| delegated_routing_v1_http_server_test.go | ||
| dht_autoclient_test.go | ||
| dht_opt_prov_test.go | ||
| diag_datastore_test.go | ||
| files_test.go | ||
| fuse_test.go | ||
| gateway_limits_test.go | ||
| gateway_range_test.go | ||
| gateway_test.go | ||
| http_gateway_over_libp2p_test.go | ||
| http_retrieval_client_test.go | ||
| identity_cid_test.go | ||
| init_test.go | ||
| ipfswatch_test.go | ||
| log_level_test.go | ||
| ls_test.go | ||
| must.go | ||
| name_test.go | ||
| p2p_test.go | ||
| peering_test.go | ||
| pin_ls_names_test.go | ||
| pin_name_validation_test.go | ||
| ping_test.go | ||
| pinning_remote_test.go | ||
| pins_test.go | ||
| provide_stats_test.go | ||
| provider_test.go | ||
| pubsub_test.go | ||
| rcmgr_test.go | ||
| repo_verify_test.go | ||
| routing_dht_test.go | ||
| rpc_auth_test.go | ||
| rpc_unixsocket_test.go | ||
| stats_test.go | ||
| swarm_test.go | ||
| telemetry_test.go | ||
| tracing_test.go | ||
| transports_test.go | ||
| webui_test.go | ||