Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package pik for openSUSE:Factory checked in 
at 2024-09-19 21:17:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pik (Old)
 and      /work/SRC/openSUSE:Factory/.pik.new.29891 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "pik"

Thu Sep 19 21:17:22 2024 rev:3 rq:1201878 version:0.6.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/pik/pik.changes  2024-08-28 21:30:33.956449409 
+0200
+++ /work/SRC/openSUSE:Factory/.pik.new.29891/pik.changes       2024-09-19 
21:17:48.239618334 +0200
@@ -1,0 +2,8 @@
+Wed Sep 18 22:03:51 UTC 2024 - Muhammad Akbar Yanuar Mantari <[email protected]>
+
+- Update to version 0.6.4
+  + feature
+    - added sarch by pid and process family
+    - feat: Quit program with ctrl+c
+
+-------------------------------------------------------------------

Old:
----
  pik-0.6.3.tar.gz

New:
----
  pik-0.6.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ pik.spec ++++++
--- /var/tmp/diff_new_pack.UsD2jo/_old  2024-09-19 21:17:48.819642377 +0200
+++ /var/tmp/diff_new_pack.UsD2jo/_new  2024-09-19 21:17:48.819642377 +0200
@@ -18,7 +18,7 @@
 
 %bcond_without test
 Name:           pik
-Version:        0.6.3
+Version:        0.6.4
 Release:        0
 Summary:        Process Interactive Kill
 License:        MIT

++++++ pik-0.6.3.tar.gz -> pik-0.6.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/.gitignore new/pik-0.6.4/.gitignore
--- old/pik-0.6.3/.gitignore    2024-08-27 17:02:37.000000000 +0200
+++ new/pik-0.6.4/.gitignore    2024-09-18 19:58:39.000000000 +0200
@@ -1,2 +1 @@
 /target
-*.tape
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/Cargo.lock new/pik-0.6.4/Cargo.lock
--- old/pik-0.6.3/Cargo.lock    2024-08-27 17:02:37.000000000 +0200
+++ new/pik-0.6.4/Cargo.lock    2024-09-18 19:58:39.000000000 +0200
@@ -519,7 +519,7 @@
 
 [[package]]
 name = "pik"
-version = "0.6.3"
+version = "0.6.4"
 dependencies = [
  "anyhow",
  "chrono",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/Cargo.toml new/pik-0.6.4/Cargo.toml
--- old/pik-0.6.3/Cargo.toml    2024-08-27 17:02:37.000000000 +0200
+++ new/pik-0.6.4/Cargo.toml    2024-09-18 19:58:39.000000000 +0200
@@ -1,6 +1,6 @@
 [package]
 name = "pik"
-version = "0.6.3"
+version = "0.6.4"
 edition = "2021"
 authors = ["Jacek Kurlit"]
 keywords = ["terminal", "process", "linux", "system", "kill"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/README.md new/pik-0.6.4/README.md
--- old/pik-0.6.3/README.md     2024-08-27 17:02:37.000000000 +0200
+++ new/pik-0.6.4/README.md     2024-09-18 19:58:39.000000000 +0200
@@ -48,6 +48,19 @@
 
 **[Archives of precompiled binaries for pik are available for Linux and 
macOS.](https://github.com/jacek-kurlit/pik/releases)**
 
+On **Fedora**
+
+```sh
+sudo dnf copr enable rusty-jack/pik
+sudo dnf install pik
+```
+
+On **Tumbleweed**
+
+```sh
+sudo zypper install pik
+```
+
 If you're a **Rust programmer**, pik can be installed with `cargo`.
 
 ```sh
@@ -65,7 +78,7 @@
 
 ### Key maps
 
-- Esc - Quit
+- Esc | Ctrl + C - Quit
 - Ctrl + X - Kill process
 - Ctrl + R - Refresh processes list
 - Ctrl + F - Details forward
@@ -84,6 +97,7 @@
 - Rust 1.79+
 - Cargo make [link](https://github.com/sagiegurari/cargo-make)
 - Cargo nextest [link](https://github.com/nextest-rs/nextest)
+- VHS [link](https://github.com/charmbracelet/vhs)
 
 ### Building
 
Binary files old/pik-0.6.3/docs/search_by_arg.gif and 
new/pik-0.6.4/docs/search_by_arg.gif differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/docs/search_by_arg.tape 
new/pik-0.6.4/docs/search_by_arg.tape
--- old/pik-0.6.3/docs/search_by_arg.tape       1970-01-01 01:00:00.000000000 
+0100
+++ new/pik-0.6.4/docs/search_by_arg.tape       2024-09-18 19:58:39.000000000 
+0200
@@ -0,0 +1,11 @@
+Output docs/search_by_arg.gif
+
+Set FontSize 24
+Set Width 1900
+Set Height 700
+
+Type "pik"
+Enter
+Sleep 2000ms
+Type "-scope"
+Sleep 5s
Binary files old/pik-0.6.3/docs/search_by_name.gif and 
new/pik-0.6.4/docs/search_by_name.gif differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/docs/search_by_name.tape 
new/pik-0.6.4/docs/search_by_name.tape
--- old/pik-0.6.3/docs/search_by_name.tape      1970-01-01 01:00:00.000000000 
+0100
+++ new/pik-0.6.4/docs/search_by_name.tape      2024-09-18 19:58:39.000000000 
+0200
@@ -0,0 +1,9 @@
+Output docs/search_by_name.gif
+
+Set FontSize 24
+Set Width 1900
+Set Height 700
+
+Type "pik firefox"
+Enter
+Sleep 5s
Binary files old/pik-0.6.3/docs/search_by_path.gif and 
new/pik-0.6.4/docs/search_by_path.gif differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/docs/search_by_path.tape 
new/pik-0.6.4/docs/search_by_path.tape
--- old/pik-0.6.3/docs/search_by_path.tape      1970-01-01 01:00:00.000000000 
+0100
+++ new/pik-0.6.4/docs/search_by_path.tape      2024-09-18 19:58:39.000000000 
+0200
@@ -0,0 +1,11 @@
+Output docs/search_by_path.gif
+
+Set FontSize 24
+Set Width 1900
+Set Height 700
+
+Type "pik /usr/bin"
+Enter
+Sleep 2000ms
+Type "/zsh"
+Sleep 5s
Binary files old/pik-0.6.3/docs/search_by_port.gif and 
new/pik-0.6.4/docs/search_by_port.gif differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/docs/search_by_port.tape 
new/pik-0.6.4/docs/search_by_port.tape
--- old/pik-0.6.3/docs/search_by_port.tape      1970-01-01 01:00:00.000000000 
+0100
+++ new/pik-0.6.4/docs/search_by_port.tape      2024-09-18 19:58:39.000000000 
+0200
@@ -0,0 +1,11 @@
+Output docs/search_by_port.gif
+
+Set FontSize 24
+Set Width 1900
+Set Height 700
+
+Type "pik"
+Enter
+Sleep 2000ms
+Type ":46631"
+Sleep 5s
Binary files old/pik-0.6.3/docs/search_everywhere.gif and 
new/pik-0.6.4/docs/search_everywhere.gif differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/docs/search_everywhere.tape 
new/pik-0.6.4/docs/search_everywhere.tape
--- old/pik-0.6.3/docs/search_everywhere.tape   1970-01-01 01:00:00.000000000 
+0100
+++ new/pik-0.6.4/docs/search_everywhere.tape   2024-09-18 19:58:39.000000000 
+0200
@@ -0,0 +1,12 @@
+Output docs/search_everywhere.gif
+
+Set FontSize 24
+Set Width 1900
+Set Height 700
+
+Type "pik port"
+Enter
+Sleep 2000ms
+Backspace 4
+Type "~portal"
+Sleep 5s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/src/processes/filters.rs 
new/pik-0.6.4/src/processes/filters.rs
--- old/pik-0.6.3/src/processes/filters.rs      2024-08-27 17:02:37.000000000 
+0200
+++ new/pik-0.6.4/src/processes/filters.rs      2024-09-18 19:58:39.000000000 
+0200
@@ -14,6 +14,8 @@
     Path,
     Args,
     Everywhere,
+    Pid,
+    ProcessFamily,
     None,
 }
 
@@ -24,6 +26,8 @@
             Some('/') => (SearchBy::Path, &query[1..]),
             Some('-') => (SearchBy::Args, &query[1..]),
             Some('~') => (SearchBy::Everywhere, &query[1..]),
+            Some('!') => (SearchBy::Pid, &query[1..]),
+            Some('@') => (SearchBy::ProcessFamily, &query[1..]),
             Some(_) => (SearchBy::Cmd, query),
             None => (SearchBy::None, query),
         };
@@ -39,6 +43,8 @@
             SearchBy::Path => self.query_matches_opt(prc.cmd_path()),
             SearchBy::Args => self.query_matches_vec(get_process_args(prc)),
             SearchBy::Port => self.query_matches_opt(ports),
+            SearchBy::Pid => self.query_eq_u32(prc.pid()),
+            SearchBy::ProcessFamily => self.query_matches_process_family(prc),
             SearchBy::Everywhere => {
                 self.query_matches_str(prc.cmd())
                     || self.query_matches_opt(prc.cmd_path())
@@ -60,6 +66,18 @@
     fn query_matches_vec(&self, s: Vec<&str>) -> bool {
         s.iter().any(|a| self.query_matches_str(a))
     }
+
+    fn query_eq_u32(&self, s: u32) -> bool {
+        s.to_string() == self.query
+    }
+
+    fn query_matches_process_family(&self, prc: &impl ProcessInfo) -> bool {
+        self.query_eq_u32(prc.pid())
+            || prc
+                .parent_id()
+                .map(|pid| self.query_eq_u32(pid))
+                .unwrap_or(false)
+    }
 }
 
 #[derive(Copy, Clone, Default)]
@@ -126,6 +144,14 @@
         assert_eq!(filter.search_by, SearchBy::Everywhere);
         assert_eq!(filter.query, "foo");
 
+        let filter = QueryFilter::new("!1234");
+        assert_eq!(filter.search_by, SearchBy::Pid);
+        assert_eq!(filter.query, "1234");
+
+        let filter = QueryFilter::new("@1234");
+        assert_eq!(filter.search_by, SearchBy::ProcessFamily);
+        assert_eq!(filter.query, "1234");
+
         let filter = QueryFilter::new("");
         assert_eq!(filter.search_by, SearchBy::None);
         assert_eq!(filter.query, "");
@@ -233,6 +259,39 @@
     }
 
     #[test]
+    fn query_filter_search_by_pid() {
+        let filter = QueryFilter::new("!1234");
+        let mut process = MockProcessInfo {
+            pid: 1234,
+            ..Default::default()
+        };
+
+        assert!(filter.accept(&process, None));
+        process.pid = 12345;
+        assert!(!filter.accept(&process, None));
+    }
+
+    #[test]
+    fn query_filter_search_by_process_family() {
+        let filter = QueryFilter::new("@1234");
+        let mut process = MockProcessInfo {
+            pid: 1234,
+            ..Default::default()
+        };
+
+        assert!(filter.accept(&process, None));
+        process.pid = 555;
+        assert!(!filter.accept(&process, None));
+
+        process.parent_pid = Some(1234);
+        assert!(filter.accept(&process, None));
+        process.parent_pid = Some(555);
+        assert!(!filter.accept(&process, None));
+        process.parent_pid = None;
+        assert!(!filter.accept(&process, None));
+    }
+
+    #[test]
     fn query_filter_search_everywhere() {
         let mut filter = QueryFilter::new("~test");
         let mut process = MockProcessInfo {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/src/tui/rendering.rs 
new/pik-0.6.4/src/tui/rendering.rs
--- old/pik-0.6.3/src/tui/rendering.rs  2024-08-27 17:02:37.000000000 +0200
+++ new/pik-0.6.4/src/tui/rendering.rs  2024-09-18 19:58:39.000000000 +0200
@@ -328,7 +328,7 @@
 }
 
 const HELP_TEXT: &str =
-    "ESC quit | <C+X> kill process | <C+R> refresh | <C+F> details forward | 
<C+B> details backward ";
+    "ESC/<C+C> quit | <C+X> kill process | <C+R> refresh | <C+F> details 
forward | <C+B> details backward ";
 
 fn render_help(f: &mut Frame, error_message: Option<&str>, area: Rect) {
     let rects = Layout::horizontal([Constraint::Percentage(25), 
Constraint::Percentage(75)])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/src/tui.rs new/pik-0.6.4/src/tui.rs
--- old/pik-0.6.3/src/tui.rs    2024-08-27 17:02:37.000000000 +0200
+++ new/pik-0.6.4/src/tui.rs    2024-09-18 19:58:39.000000000 +0200
@@ -109,6 +109,9 @@
                     Esc => return Ok(()),
                     Up | BackTab => app.tui.select_previous_row(),
                     Tab | Down => app.tui.select_next_row(),
+                    Char('c') if key.modifiers.contains(KeyModifiers::CONTROL) 
=> {
+                        return Ok(());
+                    }
                     Char('x') if key.modifiers.contains(KeyModifiers::CONTROL) 
=> {
                         app.kill_selected_process()
                     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pik-0.6.3/tests/processes_search.rs 
new/pik-0.6.4/tests/processes_search.rs
--- old/pik-0.6.3/tests/processes_search.rs     2024-08-27 17:02:37.000000000 
+0200
+++ new/pik-0.6.4/tests/processes_search.rs     2024-09-18 19:58:39.000000000 
+0200
@@ -1,3 +1,5 @@
+use std::{thread, time::Duration};
+
 use pik::processes::{FilterOptions, ProcessManager};
 
 #[test]
@@ -43,8 +45,36 @@
 fn should_find_cargo_process_by_port() {
     let test_server = TestServer::new().unwrap();
     let port = test_server.port();
+    // NOTE: Someties system needs time to notice the port is in use
+    thread::sleep(Duration::from_millis(250));
     let mut process_manager = ProcessManager::new().unwrap();
     let results = process_manager.find_processes(&format!(":{}", port), 
FilterOptions::default());
     assert!(!results.is_empty());
     assert!(results.iter().all(|p| p.ports == Some(format!("{}", port))));
 }
+
+#[test]
+fn should_find_cargo_process_by_pid() {
+    let mut process_manager = ProcessManager::new().unwrap();
+    let results = process_manager.find_processes("cargo", 
FilterOptions::default());
+    let cargo_process_pid = results.nth(Some(0)).map(|r| r.pid).unwrap();
+
+    let restults = process_manager
+        .find_processes(&format!("!{}", cargo_process_pid), 
FilterOptions::default());
+    assert_eq!(restults.len(), 1);
+    assert_eq!(restults.nth(Some(0)).unwrap().pid, cargo_process_pid);
+}
+
+#[test]
+fn should_find_cargo_process_by_process_family() {
+    let mut process_manager = ProcessManager::new().unwrap();
+    let results = process_manager.find_processes("cargo", 
FilterOptions::default());
+    let cargo_process_pid = results.nth(Some(0)).map(|r| r.pid).unwrap();
+
+    let results = process_manager
+        .find_processes(&format!("@{}", cargo_process_pid), 
FilterOptions::default());
+    assert!(!results.is_empty());
+    assert!(results
+        .iter()
+        .all(|p| p.pid == cargo_process_pid || p.parent_pid == 
Some(cargo_process_pid)));
+}

Reply via email to