Skip to content

Commit

Permalink
Add FileRecycleEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Jul 20, 2023
1 parent 00d5d0a commit d1ef998
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -55,7 +55,7 @@ AHK_X11 can be used completely without a terminal. You can however if you want u
<details><summary><strong>CLICK TO SEE WHICH COMMANDS ARE IMPLEMENTED AND WHICH ARE MISSING</strong>. Note however that this is not very representative. For example, no `Gui` sub command is included in the listing. For a better overview on what is already done, skim through the <a href="https://phil294.github.io/AHK_X11"><b>FULL DOCUMENTATION HERE</b></a>.</summary>

```diff
DONE ?% (122/220):
DONE ?% (123/220):
+ Else, { ... }, Break, Continue, Return, Exit, GoSub, GoTo, IfEqual, Loop, SetEnv, Sleep, FileCopy,
+ SetTimer, WinActivate, MsgBox, Gui, SendRaw, #Persistent, ExitApp,
+ EnvAdd, EnvSub, EnvMult, EnvDiv, ControlSendRaw, IfWinExist/IfWinNotExist, SetWorkingDir,
Expand All @@ -72,7 +72,8 @@ DONE ?% (122/220):
+ PixelSearch, #Include, InputBox, ClipWait, EnvSet, SetKeyDelay, SetMouseDelay, MouseClickDrag,
+ #NoTrayIcon, TrayTip, Random, Shutdown, RunAs, SoundGet, SoundSet, SoundPlay, Sort,
+ StringTrimLeft, StringTrimRight, WinMinimizeAll, WinMinimizeAllUndo, WinSetTitle, WinWait,
+ WinWaitClose, WinWaitActive, WinWaitNotActive, DriveSpaceFree, FileGetSize, FileRecycle
+ WinWaitClose, WinWaitActive, WinWaitNotActive, DriveSpaceFree, FileGetSize, FileRecycle,
+ FileRecycleEmpty

NEW ?% (9/220): (not part of spec or from a more recent version)
@@ Echo, ahk_x11_print_vars, FileRead, RegExGetPos, RegExReplace, EnvGet, Click @@
Expand All @@ -87,13 +88,13 @@ REMOVED ?% (11/220):
# AutoTrim: It's always Off. It would not differentiate between %a_space% and %some_var%.
# It's possible but needs significant work.

TO DO ?% (74/220): alphabetically
TO DO ?% (73/220): alphabetically
- BlockInput, Control, ControlFocus, ControlGet, ControlGetFocus,
- ControlMove,
- DetectHiddenText, DetectHiddenWindows, Drive, DriveGet,
- FileCopyDir, FileCreateShortcut,
- FileInstall, FileGetAttrib, FileGetShortcut, FileGetTime, FileGetVersion,
- FileMove, FileMoveDir, FileRecycleEmpty, FileRemoveDir,
- FileMove, FileMoveDir, FileRemoveDir,
- FormatTime, GroupActivate, GroupAdd,
- GroupClose, GroupDeactivate, GuiControlGet,
- If var is [not] type,
Expand Down
16 changes: 8 additions & 8 deletions docs/index.html
Expand Up @@ -144,7 +144,7 @@ <h2>Table of contents </h2>
<a href="#FileRecycle.htm">FileRecycle</a>
</li>
<li>
<a class="tbd" href="#FileRecycleEmpty.htm">FileRecycleEmpty</a>
<a href="#FileRecycleEmpty.htm">FileRecycleEmpty</a>
</li>
<li>
<a class="tbd" href="#FileRemoveDir.htm">FileRemoveDir</a>
Expand Down Expand Up @@ -2227,7 +2227,7 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
<td height="16" class="calibre4">Sends a file or directory to the recycle bin, if possible.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileRecycleEmpty.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycleEmpty</a></td>
<td height="16" class="calibre4"><a href="#FileRecycleEmpty.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycleEmpty</a></td>
<td height="16" class="calibre4">Empties the recycle bin.</td>
</tr>
<tr class="calibre3">
Expand Down Expand Up @@ -4047,23 +4047,23 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileRecycleEmpty.htm" href="#FileRecycleEmpty.htm">#</a> <h2 class="calibre17">FileRecycleEmpty</h2> [v1.0.09+]
<a id="FileRecycleEmpty.htm" href="#FileRecycleEmpty.htm">#</a> <h2 class="calibre17">FileRecycleEmpty</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Empties the recycle bin. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileRecycleEmpty [, DriveLetter]</td>
<td height="48" class="calibre4">FileRecycleEmpty <span class="tbd">[, DriveLetter]</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<tr class="calibre3 tbd">
<td width="15%" class="calibre4">DriveLetter</td>
<td width="85%" class="calibre4">If omitted, the recycle bin for all drives is emptied. Otherwise, specify a drive letter such as C:\</td>
</tr>
Expand All @@ -4074,14 +4074,14 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> This commands requires MS Internet Explorer 4 or greater to be installed.</p>
<p class="calibre8 rm"> This commands requires MS Internet Explorer 4 or greater to be installed.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileRecycle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycle</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a>, <a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>, <a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileRecycleEmpty, C:\ <br class="calibre12" />
<p class="calibre8"> FileRecycleEmpty <br class="calibre12" />
</p>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/cmd/file/file-recycle-empty.cr
@@ -0,0 +1,10 @@
# FileRecycleEmpty [, DriveLetter]
class Cmd::File::FileRecycleEmpty < Cmd::Base
def self.min_args; 0 end
def self.max_args; 1 end
def self.sets_error_level; true end
def run(thread, args)
status = Process.run("rm -rf ${XDG_DATA_HOME:-$HOME/.local/share}/Trash/*", shell: true).exit_code
status == 0 ? "0" : "1"
end
end

0 comments on commit d1ef998

Please sign in to comment.