melusina-org / cl-rashell

Resilient replicant Shell Programming Library for Common Lisp
MIT License
21 stars 1 forks source link

Links to the documention are broken :( #1

Open svetlyak40wt opened 7 months ago

foretspaisibles commented 6 months ago

The links used to point to artefacts produced by a workflow and those seems to have expired. I triggered a new execution of the pipeline so that new documentation are produced: https://github.com/melusina-org/cl-rashell/actions/runs/8605392997

A better way to handle this would be to create a release and attach the documentation to the release.

(BTW What is your interest in Rashell? The define-command macro should have an easier syntax I believe, and it should rely on UIOP or EXTERNAL-PROGRAM. If you have suggestions about this or on other topics, please share them I'm all ears!)

foretspaisibles commented 6 months ago

The job ended :

HTML https://github.com/melusina-org/cl-rashell/actions/runs/8605392997/artifacts/1395425428

INFO https://github.com/melusina-org/cl-rashell/actions/runs/8605392997/artifacts/1395425429

PDF https://github.com/melusina-org/cl-rashell/actions/runs/8605392997/artifacts/1395425430

svetlyak40wt commented 6 months ago

Thank you! I've read through a manual and this project looks interesting.

It would be wonderful to have some examples in the beginning of the documentation – just to demonstrate how to use the system. For example, how to run a command and retrieve results, how to combine commands together (is it possible to build a pipes?). For example, if I need to find all git repositories in the home folder and to get only repositories having uncommited changes, how should I structure my query using rashell?

foretspaisibles commented 6 months ago

It would be wonderful to have some examples in the beginning of the documentation

This is a great idea, I will add some.

is it possible to build a pipes?

It is not possible to do that yet. The main reasons why it is not are:

For example, if I need to find all git repositories in the home folder and to get only repositories having uncommited changes, how should I structure my query using rashell?

That really depends on how much logic you want to move in Common Lisp and how much you want to have on the UNIX Shell. You could adapt the following one-liner:

find . -type d -name '.git' -exec sh -c 'repository="${1%/.git}"; git_repository_clean_p () { test -z "$(git status --porcelain)"; }; cd "${repository}"; if ! git_repository_clean_p; then printf "%s\\n" "${repository}"; fi' -- '{}' ';'

Maybe a nicer way would be to first find the repositories and then filter the repositories which are dirty. I am somewhat planning to support git operations in a “rashell/git” system.

BTW The find command above could take very long, maybe check -maxdepth and -mindepth.

svetlyak40wt commented 6 months ago

Right now I'm using simple-inferiors, which is able to run commands in a specified directory.

For example, here is how I've defined a function to check if repositroy has some uncommited changes:

(defun has-uncommited-changes-p (project)
  (simple-inferiors:with-chdir ((get-staging-dir project))
    (not (str:emptyp (simple-inferiors:run "git" (list "status" "--porcelain=2")
                                       :output :string)))))