rtfm-filemanager 5.7 → 5.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rtfm +5 -25
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a98e564810c828a6973aa5a7b968b560ee32af1ff3a2c916a9ae31f15a30489
4
- data.tar.gz: dafe630653b09a6effb439fc0d79fce6636473b5eaa4a6104858f7311a5b01a4
3
+ metadata.gz: 1a161027d9022267d289243bfcaeca20a4f53c62f337950f1a8f0fde673e8052
4
+ data.tar.gz: 59fa34172a017c4b076623249eee783f648767431438be6e49ae947a4e08d1ca
5
5
  SHA512:
6
- metadata.gz: 8c3ba0bbf931a118c75ce53c2388b139b8684d25c63c83df565659697daf218f59533a5506883ae24c2a79feb614973546377d57c2ab7531bb8ec63c44b49cc8
7
- data.tar.gz: 6c65eca97ca5898cbd9774564e1175ba859d29af622553a0cd93070e6d1bc3355e0d0bc08ef66d606da00b48cb5b6fd7d789909b0f95bd7e5f4966db642ccad2
6
+ metadata.gz: cc373399f44b2686f22738a1e3241139391c42108f0a02e94ca157d8e38c5b21e73a0ceeff68f3dc26ce3c9f9e99ca6e2b7ec0e387c1ef9cc341e43988e56d87
7
+ data.tar.gz: 633482c052ea761d444c4bd5b9b6cbf72c5671709ce2f50769dd36ba76eb40d35cc2034c531cd9e99a7821bdfe7419c87239f4a006d855bd4374b7d072da9221
data/bin/rtfm CHANGED
@@ -18,7 +18,7 @@
18
18
  # get a great understanding of the code itself by simply sending
19
19
  # or pasting this whole file into you favorite AI for coding with
20
20
  # a prompt like this: "Help me understand every part of this code".
21
- @version = '5.7' # Added use of @interactive on automatic opening of selected files
21
+ @version = '5.7.1' # Removed debug output
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -1872,36 +1872,26 @@ end
1872
1872
  def get_interactive_program(file_path) # HELPER FOR OPEN_SELECTED TO USE @interactive {{{2
1873
1873
  begin
1874
1874
  inter_list = (@interactive || '').split(',').map(&:strip)
1875
-
1876
1875
  if @runmailcap
1877
- # Check what run-mailcap would actually execute
1878
- # Use --norun to see the command without executing it
1876
+ # Check what run-mailcap would execute. Use --norun to see the command without executing it
1879
1877
  mailcap_output = `run-mailcap --norun #{Shellwords.escape(file_path)} 2>/dev/null`.chomp
1880
-
1881
- # Debug: log what we found
1882
- @pB.say("Debug: mailcap would run: '#{mailcap_output}'") unless mailcap_output.empty?
1883
-
1884
1878
  if !mailcap_output.empty?
1885
1879
  # Extract the program name from the command
1886
1880
  # Handle cases like "/usr/bin/mplayer file.mp4" or "mplayer %s"
1887
1881
  cmd_parts = mailcap_output.split
1888
1882
  prog = cmd_parts.first
1889
1883
  prog = File.basename(prog) if prog
1890
-
1891
- # Debug: log program detection
1892
- @pB.say("Debug: detected program = '#{prog}', in interactive list? #{inter_list.include?(prog)}")
1893
-
1894
1884
  return prog if prog && inter_list.include?(prog)
1895
1885
  end
1896
1886
  else
1897
1887
  # Check what xdg-open would use
1898
1888
  mimetype = `file --mime-type -b #{Shellwords.escape(file_path)}`.chomp
1899
1889
  desktop_file = `xdg-mime query default #{Shellwords.escape(mimetype)}`.chomp
1900
-
1890
+
1901
1891
  if desktop_file && !desktop_file.empty?
1902
1892
  # Read the desktop file to get the actual command
1903
1893
  desktop_path = nil
1904
- ['/usr/share/applications/', '/usr/local/share/applications/',
1894
+ ['/usr/share/applications/', '/usr/local/share/applications/',
1905
1895
  File.join(Dir.home, '.local/share/applications/')].each do |dir|
1906
1896
  path = File.join(dir, desktop_file)
1907
1897
  if File.exist?(path)
@@ -1909,7 +1899,6 @@ def get_interactive_program(file_path) # HELPER FOR OPEN_SELECTED TO USE @intera
1909
1899
  break
1910
1900
  end
1911
1901
  end
1912
-
1913
1902
  if desktop_path
1914
1903
  content = File.read(desktop_path)
1915
1904
  exec_line = content[/^Exec=(.*)$/m, 1]
@@ -1930,24 +1919,21 @@ end
1930
1919
 
1931
1920
  def open_selected(html = nil) # OPEN SELECTED FILE {{{2
1932
1921
  require 'tmpdir' unless Dir.respond_to?(:tmpdir)
1933
-
1934
1922
  if File.directory?(@selected) # Dir? just cd into it
1935
1923
  mark_latest
1936
1924
  Dir.chdir(@selected) rescue nil
1937
1925
  return
1938
1926
  end
1939
-
1927
+
1940
1928
  # Check if this file should use an interactive program (same as § prefix logic)
1941
1929
  if !html && (prog = get_interactive_program(@selected))
1942
1930
  cmd = "#{prog} #{Shellwords.escape(@selected)}"
1943
-
1944
1931
  # Use exactly the same logic as command_mode with § prefix (force interactive)
1945
1932
  # Restore shell tty so Ctrl-C/D work
1946
1933
  system("stty #{ORIG_STTY} < /dev/tty")
1947
1934
  # Clear to top-left
1948
1935
  system('clear < /dev/tty > /dev/tty')
1949
1936
  Cursor.show
1950
-
1951
1937
  # Spawn on real tty
1952
1938
  pid = Process.spawn(cmd,
1953
1939
  in: '/dev/tty',
@@ -1959,7 +1945,6 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
1959
1945
  Process.kill('TERM', pid) rescue nil
1960
1946
  retry
1961
1947
  end
1962
-
1963
1948
  # Restore raw/no-echo for RTFM
1964
1949
  system('stty raw -echo isig < /dev/tty')
1965
1950
  $stdin.raw!
@@ -1970,10 +1955,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
1970
1955
  render
1971
1956
  return
1972
1957
  end
1973
-
1974
1958
  tmpfile = File.join(Dir.tmpdir, 'rtfm_err.log')
1975
1959
  paths = (@tagged + [@selected]).uniq
1976
-
1977
1960
  if html # html mode - open in HTML-browser
1978
1961
  esc = paths.map { |p| Shellwords.escape(p) }.join(' ')
1979
1962
  shell("xdg-open #{esc} &", err: tmpfile)
@@ -1987,7 +1970,6 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
1987
1970
  end
1988
1971
  return
1989
1972
  end
1990
-
1991
1973
  if File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
1992
1974
  system("stty #{ORIG_STTY} < /dev/tty")
1993
1975
  # Clear to top-left
@@ -2003,14 +1985,12 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
2003
1985
  render
2004
1986
  return
2005
1987
  end
2006
-
2007
1988
  if @runmailcap # Open with run-mailcap or xdg-open
2008
1989
  arg = paths.map { |p| Shellwords.escape(p) }.join(' ')
2009
1990
  shell("run-mailcap #{arg} &", err: tmpfile)
2010
1991
  else
2011
1992
  shell("xdg-open #{Shellwords.escape(@selected)} &", err: tmpfile)
2012
1993
  end
2013
-
2014
1994
  # Clean up
2015
1995
  Rcurses.clear_screen; refresh; render
2016
1996
  if File.exist?(tmpfile)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: '5.7'
4
+ version: 5.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '7.4'
55
55
  description: |-
56
56
  Major release - RTFM v5: Complete rewrite using rcurses (https://github.com/isene/rcurses). Massive improvements. AI integration.
57
- A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around easily, delete, rename, copy, symlink and move files. RTFM is one of the most feature-packed terminal file managers. 5.7: Added use of @interactive on automatic opening of selected files.
57
+ A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around easily, delete, rename, copy, symlink and move files. RTFM is one of the most feature-packed terminal file managers. 5.7.1: Removed debug output.
58
58
  email: g@isene.com
59
59
  executables:
60
60
  - rtfm