FreeBSD Bugzilla – Attachment 234274 Details for
Bug 264301
[NEW PORT] sysutils/as-tree: Print a list of paths as a tree of paths
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
0001-NEW-PORT-sysutils-as-tree-Print-a-list-of-paths-as-a.patch (text/plain), 7.35 KB, created by
sec.research.2005
on 2022-05-27 23:04:54 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
sec.research.2005
Created:
2022-05-27 23:04:54 UTC
Size:
7.35 KB
patch
obsolete
>From 95d7d17a6da7b76e74e354f4a38317fb780e18b9 Mon Sep 17 00:00:00 2001 >From: Mostly BSD <sec.research.2005@gmail.com> >Date: Fri, 13 May 2022 16:31:25 -0500 >Subject: [PATCH] [NEW PORT] sysutils/as-tree: Print a list of paths as a tree > of paths > >--- > sysutils/as-tree/Makefile | 37 ++++++++ > sysutils/as-tree/distinfo | 19 ++++ > sysutils/as-tree/files/patch-src__main.rs | 107 ++++++++++++++++++++++ > sysutils/as-tree/pkg-descr | 9 ++ > 4 files changed, 172 insertions(+) > create mode 100644 sysutils/as-tree/Makefile > create mode 100644 sysutils/as-tree/distinfo > create mode 100644 sysutils/as-tree/files/patch-src__main.rs > create mode 100644 sysutils/as-tree/pkg-descr > >diff --git a/sysutils/as-tree/Makefile b/sysutils/as-tree/Makefile >new file mode 100644 >index 000000000..17ad06af0 >--- /dev/null >+++ b/sysutils/as-tree/Makefile >@@ -0,0 +1,37 @@ >+PORTNAME= as-tree >+DISTVERSION= 0.12.1 >+CATEGORIES= sysutils >+ >+MAINTAINER= sec.research.2005@gmail.com >+COMMENT= Print a list of paths as a tree of paths >+ >+LICENSE= BlueOak >+LICENSE_NAME= Blue Oak Model License >+LICENSE_FILE= ${WRKSRC}/LICENSE.md >+LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept >+ >+USES= cargo >+USE_GITHUB= yes >+GH_ACCOUNT= jez >+GH_TAGNAME= 0036c20 >+ >+OPTIONS_DEFINE= DOCS >+OPTIONS_DEFAULT= DOCS >+ >+PORTDOCS= README.md >+ >+CARGO_CRATES= ansi_term-0.12.1 \ >+ atty-0.2.14 \ >+ hermit-abi-0.1.12 \ >+ libc-0.2.70 \ >+ lscolors-0.7.0 \ >+ winapi-0.3.8 \ >+ winapi-i686-pc-windows-gnu-0.4.0 \ >+ winapi-x86_64-pc-windows-gnu-0.4.0 >+ >+PLIST_FILES= bin/${PORTNAME} >+ >+post-install: >+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME} >+ >+.include <bsd.port.mk> >diff --git a/sysutils/as-tree/distinfo b/sysutils/as-tree/distinfo >new file mode 100644 >index 000000000..aab16fd42 >--- /dev/null >+++ b/sysutils/as-tree/distinfo >@@ -0,0 +1,19 @@ >+TIMESTAMP = 1652470669 >+SHA256 (rust/crates/ansi_term-0.12.1.crate) = d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2 >+SIZE (rust/crates/ansi_term-0.12.1.crate) = 24838 >+SHA256 (rust/crates/atty-0.2.14.crate) = d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8 >+SIZE (rust/crates/atty-0.2.14.crate) = 5470 >+SHA256 (rust/crates/hermit-abi-0.1.12.crate) = 61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4 >+SIZE (rust/crates/hermit-abi-0.1.12.crate) = 9217 >+SHA256 (rust/crates/libc-0.2.70.crate) = 3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f >+SIZE (rust/crates/libc-0.2.70.crate) = 472909 >+SHA256 (rust/crates/lscolors-0.7.0.crate) = 1f77452267149eac960ded529fe5f5460ddf792845a1d71b5d0cfcee5642e47e >+SIZE (rust/crates/lscolors-0.7.0.crate) = 18036 >+SHA256 (rust/crates/winapi-0.3.8.crate) = 8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6 >+SIZE (rust/crates/winapi-0.3.8.crate) = 1128308 >+SHA256 (rust/crates/winapi-i686-pc-windows-gnu-0.4.0.crate) = ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6 >+SIZE (rust/crates/winapi-i686-pc-windows-gnu-0.4.0.crate) = 2918815 >+SHA256 (rust/crates/winapi-x86_64-pc-windows-gnu-0.4.0.crate) = 712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f >+SIZE (rust/crates/winapi-x86_64-pc-windows-gnu-0.4.0.crate) = 2947998 >+SHA256 (jez-as-tree-0.12.1-0036c20_GH0.tar.gz) = e598fe12f95f464a7768a7f7317ab7af2741c97a6867297d52b210b34012a25b >+SIZE (jez-as-tree-0.12.1-0036c20_GH0.tar.gz) = 132668 >diff --git a/sysutils/as-tree/files/patch-src__main.rs b/sysutils/as-tree/files/patch-src__main.rs >new file mode 100644 >index 000000000..7347b6296 >--- /dev/null >+++ b/sysutils/as-tree/files/patch-src__main.rs >@@ -0,0 +1,107 @@ >+--- src/main.rs.orig 2021-03-09 04:30:36 UTC >++++ src/main.rs >+@@ -4,7 +4,7 @@ >+ >+ use std::collections::BTreeMap; >+ use std::fs::File; >+-use std::io::{self, BufRead, BufReader}; >++use std::io::{self, BufRead, BufReader, Write}; >+ use std::path::{Path, PathBuf}; >+ >+ use lscolors::{LsColors, Style}; >+@@ -41,13 +41,14 @@ >+ >+ fn _print( >+ &self, >++ stdout: &mut io::StdoutLock, >+ top: bool, >+ prefix: &str, >+ join_with_parent: bool, >+ lscolors: &LsColors, >+ parent_path: PathBuf, >+ full_path: bool, >+- ) { >++ ) -> io::Result<()> { >+ let normal_prefix = format!("{}â ", prefix); >+ let last_prefix = format!("{} ", prefix); >+ >+@@ -84,48 +85,54 @@ >+ "/" >+ }; >+ if should_print { >+- print!("{}{}{}", style.paint(joiner), painted, newline); >++ write!(stdout, "{}{}{}", style.paint(joiner), painted, newline)?; >+ } >+ prefix >+ } else if !is_last { >+ if should_print { >+- print!("{}âââ {}{}", prefix, painted, newline); >++ write!(stdout, "{}âââ {}{}", prefix, painted, newline)?; >+ } >+ &normal_prefix >+ } else { >+ if should_print { >+- print!("{}âââ {}{}", prefix, painted, newline); >++ write!(stdout, "{}âââ {}{}", prefix, painted, newline)?; >+ } >+ &last_prefix >+ }; >+ >+ it._print( >++ stdout, >+ false, >+ next_prefix, >+ contains_singleton_dir, >+ lscolors, >+ current_path, >+ full_path, >+- ) >++ )?; >+ } >++ >++ Ok(()) >+ } >+ >+- fn print(&self, lscolors: &LsColors, full_path: bool) { >++ fn print(&self, lscolors: &LsColors, full_path: bool) -> io::Result<()> { >+ if self.trie.is_empty() { >+- println!(); >+- return; >++ return Ok(()); >+ } >+ >++ let stdout = io::stdout(); >++ let handle = &mut stdout.lock(); >++ >+ // This works because PathBuf::from(".").join(PathBuf::from("/")) == PathBuf::from("/") >+ let current_path = PathBuf::from("."); >+ let contains_singleton_dir = self.contains_singleton_dir(); >+ >+ if !contains_singleton_dir { >+ let style = ansi_style_for_path(&lscolors, ¤t_path); >+- println!("{}", style.paint(current_path.to_string_lossy())); >++ writeln!(handle, "{}", style.paint(current_path.to_string_lossy()))?; >+ } >+ >+ self._print( >++ handle, >+ true, >+ "", >+ contains_singleton_dir, >+@@ -175,7 +182,14 @@ >+ options::Colorize::Never => LsColors::empty(), >+ }; >+ >+- trie.print(&lscolors, options.full_path); >++ let result = trie.print(&lscolors, options.full_path); >+ >+- io::Result::Ok(()) >++ match result { >++ Err(e) if e.kind() == io::ErrorKind::BrokenPipe => { >++ // ignore broken pipe errors >++ io::Result::Ok(()) >++ }, >++ e@Err(_) => e, >++ _ => io::Result::Ok(()) >++ } >+ } >diff --git a/sysutils/as-tree/pkg-descr b/sysutils/as-tree/pkg-descr >new file mode 100644 >index 000000000..3a165372e >--- /dev/null >+++ b/sysutils/as-tree/pkg-descr >@@ -0,0 +1,9 @@ >+Print a list of paths as a tree of paths >+ >+This tool is particularly useful when used with `find` or `fd` >+to produce such a list of files. >+It's similar in spirit to `tree`, but `find` and `fd` tend to be >+more powerful when it comes to controlling which files to list. >+ >+ >+WWW: https://github.com/ez/as-tree >-- >2.36.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 264301
: 234274 |
234275