Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sgit.1 man page, minor fixes in sgit #982

Merged
merged 2 commits into from
Sep 29, 2023
Merged

Conversation

xexyl
Copy link

@xexyl xexyl commented Sep 28, 2023

Something that is lacking from the man page is that there are no
examples. This is currently being justified by the fact that the
README.md has examples but since that might not always be available this
doesn't hold very well. This will likely be fixed another time when I
have more energy, time and patience for it.

As it is not clear to me how any documentation should be 'installed' I
have not updated the Makefile to address this. That can be done later -
or not for that matter.

The usage string has been improved a bit. There was one thing that could
be more clear and there was something missing too.

Fixed exit codes when command line error.

README.md now refers to the man page and the usage string was updated to
match the usage string change.

New version 0.0.11-1 28-04-2023.

(Well .. some warnings. See below.)

Depending on system (compiler and possibly platform) different warnings
were being triggered. It was easy to fix the code for some of them (like
wrong prototypes and then #including stdlib.h) but this caused problems
in another way (in macOS clang - clang is more strict and has -Werror or
else an equivalent by default which might or might not be possible to
disable .. haven't tried it) but since the code works as is I simply
silenced the warnings in the Makefile.

A note that might be useful to know for other Makefiles that has to do
with the fact that macOS gcc equates to clang (which I have noted many
times as it's an unfortunate problem): since it is seen as gcc the
Makefile check for gcc only will be triggered in macOS even though the
compiler is clang.

A similar problem is that if one does in linux just 'make' they might
end up with the compiler being 'cc' so I added an ifeq in the Makefile
for just cc. It might or might not be useful to add this to the rest of
the entry Makefiles. The same warnings disabled for cc and gcc were
added.

Another thing to keep in mind is with gcc/cc in linux it will still show
the warnings that were silenced as in it will show that some warnings
might have been disabled (it won't warn about the problems but will note
that some warnings were disabled - no I can't figure out the real
purpose of it either other than to be extra careful .. or annoying :-) ).

In linux clang also triggers even more warnings including the ridiculous
misleading indentation that they unfortunately adopted from gcc. These
warnings were not disabled at this time.

As far as the README.md goes one of the to run commands was incorrect in
that when running './wall' by itself one should put in numbers only, not
just any text.
Something that is lacking from the man page is that there are no
examples. This is currently being justified by the fact that the
README.md has examples but since that might not always be available this
doesn't hold very well. This will likely be fixed another time when I
have more energy, time and patience for it.

As it is not clear to me how any documentation should be 'installed' I
have not updated the Makefile to address this. That can be done later -
or not for that matter.

The usage string has been improved a bit. There was one thing that could
be more clear and there was something missing too.

Fixed exit codes when command line error.

README.md now refers to the man page and the usage string was updated to
match the usage string change.

New version 0.0.11-1 28-04-2023.
@xexyl
Copy link
Author

xexyl commented Sep 28, 2023

Please advise on whether or not the man page should be copied to any directory. I do not mind one way or another but I felt like it should at least be here now that the repo itself has it. It doesn't have to be copied at all to any other directory but should you wish to tell me where or if you want to do it I'm happy to do it or have you take care of it. But it did feel important that it is added to the repo at least because otherwise it would not be complete.

As noted in the log it does currently lack examples that the README.md has but I'll have to fix that another time ... too tired and don't have the patience for it right now.

The script, also noted in the log, has had some fixes as well.

As I'm very tired now I imagine I won't do more today but we'll see. Hope you're feeling better now and hope you have a great day! I'll update you more later on .. I hope. Some changes since I wrote about it earlier on.

@lcn2
Copy link

lcn2 commented Sep 29, 2023

Please advise on whether or not the man page should be copied to any directory. I do not mind one way or another but I felt like it should at least be here now that the repo itself has it. It doesn't have to be copied at all to any other directory but should you wish to tell me where or if you want to do it I'm happy to do it or have you take care of it. But it did feel important that it is added to the repo at least because otherwise it would not be complete.

As noted in the log it does currently lack examples that the README.md has but I'll have to fix that another time ... too tired and don't have the patience for it right now.

The script, also noted in the log, has had some fixes as well.

As I'm very tired now I imagine I won't do more today but we'll see. Hope you're feeling better now and hope you have a great day! I'll update you more later on .. I hope. Some changes since I wrote about it earlier on.

We recommend creating your own repo for the sgit tool. Once you do, we will clone that repo and install sgit from that repo. The sgit tool has graduated to becoming its own fine tool and no longer needs to live in this repo.

Once you do, the `src/sgit' directory tree can be removed from the repo.

@lcn2 lcn2 merged commit d6b2271 into ioccc-src:master Sep 29, 2023
@xexyl
Copy link
Author

xexyl commented Sep 29, 2023

Please advise on whether or not the man page should be copied to any directory. I do not mind one way or another but I felt like it should at least be here now that the repo itself has it. It doesn't have to be copied at all to any other directory but should you wish to tell me where or if you want to do it I'm happy to do it or have you take care of it. But it did feel important that it is added to the repo at least because otherwise it would not be complete.

As noted in the log it does currently lack examples that the README.md has but I'll have to fix that another time ... too tired and don't have the patience for it right now.

The script, also noted in the log, has had some fixes as well.

As I'm very tired now I imagine I won't do more today but we'll see. Hope you're feeling better now and hope you have a great day! I'll update you more later on .. I hope. Some changes since I wrote about it earlier on.

We recommend creating your own repo for the sgit tool. Once you do, we will clone that repo and install sgit from that repo. The sgit tool has graduated to becoming its own fine tool and no longer needs to live in this repo.

Once you do, the `src/sgit' directory tree can be removed from the repo.

But it will still be published on the website, right?

Anyway it already is in a repo and I think you might have even starred it. That's what I have been doing actually: committing there and then copying the files to this repository.

I can give you the link when I am at the laptop later on.

This cloning idea btw is what I was referring to the other day kind of like how in mkiocccentry THAT repo clones others only that this one would clone the sgit one. You misunderstood though thinking that I was suggesting that the mkiocccentry repo should have this when I was actually thinking about simplifying the way THIS repo has it.

That way I don't have to always do another pull request: you or I can j@ run a make command to do it.

This way the website will have it but in an easier way.

Perhaps the Makefile will be just a new rule that does the cloning and copies the files to the right directory but maybe has the files themselves (in the src directory) in the .gitignore ?

Anyway that's what I meant all along: it will simplify having the script published in the website but without requiring me to repeatedly copy files over each time I make a new commit.

Thank you for clarifying. I will reply to other things later .. can't sleep but still quite sleepy :( Hope you're sleeping well though!

@xexyl
Copy link
Author

xexyl commented Sep 29, 2023

The link is: https://github.com/xexyl/sgit/

I might play with a clone rule but we will see. In the end if I do you can modify it to your liking but I might just leave it to you as you have a better idea about the structure of the website.

Will try resting again soon. I will reply to your other comments later.

@lcn2
Copy link

lcn2 commented Sep 30, 2023

Please advise on whether or not the man page should be copied to any directory. I do not mind one way or another but I felt like it should at least be here now that the repo itself has it. It doesn't have to be copied at all to any other directory but should you wish to tell me where or if you want to do it I'm happy to do it or have you take care of it. But it did feel important that it is added to the repo at least because otherwise it would not be complete.

As noted in the log it does currently lack examples that the README.md has but I'll have to fix that another time ... too tired and don't have the patience for it right now.

The script, also noted in the log, has had some fixes as well.

As I'm very tired now I imagine I won't do more today but we'll see. Hope you're feeling better now and hope you have a great day! I'll update you more later on .. I hope. Some changes since I wrote about it earlier on.

We recommend creating your own repo for the sgit tool. Once you do, we will clone that repo and install sgit from that repo. The sgit tool has graduated to becoming its own fine tool and no longer needs to live in this repo.
Once you do, the `src/sgit' directory tree can be removed from the repo.

But it will still be published on the website, right?

The creation of the src tree in the temp-test-ioccc was probably a mistake. Tools that the IOCCC judges need to maintain the web site probably belong elsewhere, such as external repos. Unlike mkiocccentry where the single repo design is needed to make it easier for someone to enter the contest by cloning just one repo, there is NO need for others to clone their own IOCCC winner repo. There is no need for non-IOCCC judges to use tools on their own IOCCC winner repo, so tools that IOCCC judges to build the site are NOT critical to users of the www.ioccc.org web site.

Tool such as src/winner_name probably belong in some ioccc-tools repo, eventually. For now, src/winner_name should probably move back under tmp. Once tmp goes away (this will happen just before the temp-test-ioccc is merged back to winners), tools that are still needed to by the judges to maintain the site will move into another repo.

Now sgit is a useful tool, independent from the IOCCC winner repo, so the sgit repo is a fitting place for it. Nevertheless once issue #2 and issue #3 are resolved, the need for a tool such as sgit to perform mass edits on the web site will be over.

@lcn2
Copy link

lcn2 commented Sep 30, 2023

The link is: https://github.com/xexyl/sgit/

I might play with a clone rule but we will see. In the end if I do you can modify it to your liking but I might just leave it to you as you have a better idea about the structure of the website.

Will try resting again soon. I will reply to your other comments later.

Given comment 1741693358, probably src should move under tmp. The src/sgit is not needed because you have the sgit repo.

@xexyl
Copy link
Author

xexyl commented Sep 30, 2023

The link is: https://github.com/xexyl/sgit/

I might play with a clone rule but we will see. In the end if I do you can modify it to your liking but I might just leave it to you as you have a better idea about the structure of the website.

Will try resting again soon. I will reply to your other comments later.

Given comment 1741693358, probably src should move under tmp. The src/sgit is not needed because you have the sgit repo.

Hmmm okay so should both tools be moved over to the tmp/ directory with the log being the explanation you gave in the comment?

And then later on the one or both might be in another repo but since I have my sgit repo it might not be needed as if you need it for any other reason (perhaps at some other point in time where mass editing could be useful) you - the judges - can clone it and use it and then make any commits (or if not necessary then don't make commits).

Is that correct? If the sgit is ever useful for the website or something else you could always have a Makefile rule that clones it kind of like the mkiocccentry repo clones other repos as well.

Does that all seem correct?

But either way: do you want me to move both tools to tmp/ or?

Also since there will be a need for sgit still what do you want me to do if I make improvements on or other changes (one of which I actually have in mind .. actually I have a couple things I might do)?

Thank you! I will be happy to do it when you clarify though I must admit that I am honoured you had the idea of having the tool in the website (though I didn't know why exactly) even if that has proven to be not necessary after all so THANK YOU for that too!

I hope you are all better now and that you are sleeping well!

I have been awake since about half past two but kind of asleep until three. I doubt that I will be able to sleep more but I will probably try in a bit.

No idea what I might get done here today but if I make any changes to sgit I will copy them here. Then when you tell me what you need with both tools I can address that.

I actually am going to try and rest now .. hopefully back later.

@xexyl
Copy link
Author

xexyl commented Sep 30, 2023

Just a reminder to myself: I'll have to update the thanks file too ... modify it to say it was used to update parts of the website easily or something, depending on how it's used.

Once we figure out what is desired of course ...

@xexyl xexyl deleted the sgit-man-page branch September 30, 2023 13:17
@lcn2
Copy link

lcn2 commented Oct 1, 2023

Hmmm okay so should both tools be moved over to the tmp/ directory with the log being the explanation you gave in the comment?

Sure, the src/ directory can be moved under the tmp/.

And then later on the one or both might be in another repo but since I have my sgit repo it might not be needed as if you need it for any other reason (perhaps at some other point in time where mass editing could be useful) you - the judges - can clone it and use it and then make any commits (or if not necessary then don't make commits).

Correct. So once the src/ directory can be moved under the tmp/, the copy of sgit can be removed and we will just use the installed sgit from the cloned sgit repo. This would leave just the src/winner_name tool. Tools like that once the temp-test-ioccc repo is ready to merge and the tmp directory is ready to go away, will be moved into a judges' "IOCCC admin" repo. Thus, the final winners IOCCC repo will just contain the winners AND related files and web pages, some of which will be maintained by tools from other repos, such as the sgit repo, the JSON tools, and the "IOCCC admin" repo.

UPDATE 0

But either way: do you want me to move both tools to tmp/ or?

Yes, as per the above.

Also since there will be a need for sgit still what do you want me to do if I make improvements on or other changes (one of which I actually have in mind .. actually I have a couple things I might do)?

Announce it in a CHANGES file, and if you think they are particularly applicable to the temp-test-ioccc repo, mention it on a comment such as under issue #5.

@xexyl
Copy link
Author

xexyl commented Oct 1, 2023

Hmmm okay so should both tools be moved over to the tmp/ directory with the log being the explanation you gave in the comment?

Sure, the src/ directory can be moved under the tmp/.

And then later on the one or both might be in another repo but since I have my sgit repo it might not be needed as if you need it for any other reason (perhaps at some other point in time where mass editing could be useful) you - the judges - can clone it and use it and then make any commits (or if not necessary then don't make commits).

Correct. So once the src/ directory can be moved under the tmp/, the copy of sgit can be removed and we will just use the installed sgit from the cloned sgit repo. This would leave just the src/winner_name tool. Tools like that once the temp-test-ioccc repo is ready to merge and the tmp directory is ready to go away, will be moved into a judges' "IOCCC admin" repo. Thus, the final winners IOCCC repo will just contain the winners AND related files and web pages, some of which will be maintained by tools from other repos, such as the sgit repo, the JSON tools, and the "IOCCC admin" repo.

'Once the copy of sgit can be moved under the tmp/ ...' makes it sound like it's not ready for that. Do you want me to wait? If yes when should I do it? I can at any rate change the thanks file to make it be what it is though the next part of your paragraph makes me not sure what that is entirely.

What do you mean by the winners repo will just contain the winners AND related files and web pages, some of which will be maintained by tools from other repos, such as the sgit repo, please ?

That sounds like there will be a clone of the sgit repo but is that the case? I got the impression earlier on that that might be the case but I think now it's just that it's a significant part of the development of the winners repo (and in particular the website). So which is it? That will help me modify the thanks file and combined with the above question about when the sgit copy should be moved to tmp/ can tell me when and how I can modify the thanks file AND do the actual move.

Thank you and either way it's a great honour so thank you for that too!

UPDATE 0

But either way: do you want me to move both tools to tmp/ or?

Yes, as per the above.

Before I do that though above it sounds like both it cannot be done yet and also that only sgit should be moved. So I'm not sure yet what you want me to do. Would you please clarify? Thanks.

Also since there will be a need for sgit still what do you want me to do if I make improvements on or other changes (one of which I actually have in mind .. actually I have a couple things I might do)?

Announce it in a CHANGES file, and if you think they are particularly applicable to the temp-test-ioccc repo, mention it on a comment such as under issue #5.

Good idea .. I can do that. Maybe backdate some entries too but I'm not sure: depends on how I feel. Not sure that'll be done today or not but I can look into it.

Hope you're sleeping well .. I am hoping I can rest again but probably won't sleep again if I can even rest.

@lcn2
Copy link

lcn2 commented Oct 2, 2023

The commit 62d40c1 has completed the action:

move src under tmp, use sgit from repo, update .gitignore

The `src/` tree has been moved under `tmp/`.

The `tmp/src/sgit` tree was removed.  Instead the sgit
as installed from the [sgit repo](https://github.com/xexyl/sgit/).

The .gitignore was sorted and cleared up.

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

The commit 62d40c1 has completed the action:

move src under tmp, use sgit from repo, update .gitignore

The `src/` tree has been moved under `tmp/`.

The `tmp/src/sgit` tree was removed.  Instead the sgit
as installed from the [sgit repo](https://github.com/xexyl/sgit/).

The .gitignore was sorted and cleared up.

This is helpful but I'm still unclear on some things. It says installed from but how so? I don't see it.

Also I need to know how it's going to be used more than it already has been so I can update the thanks file. It says installed but how will that happen and in what way?

Thanks.

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

.. ah, maybe by installed you mean that you installed it on your system?

If that's the case that's an honour (well it's all been an honour including everything with sgit) but still I'd like to know how the sgit reference in thanks file should be updated. I have some thoughts but I want to know what you're planning on doing too so it can be more accurate. I certainly have used it a fair bit to help with the website but not sure what else to say or how it'll be used in the future.

THANK YOU!

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

... as for winner_name is it correct that without the -a option it should print only those with one _ in the name? Since without it it doesn't show my name or for example Thomas_A_Fine or Thomas_P_John.

@lcn2
Copy link

lcn2 commented Oct 2, 2023

This is helpful but I'm still unclear on some things. It says installed from but how so? I don't see it.

You do it:

cd /some/where
sgit clone https://github.com/xexyl/sgit.git
cd sgit
make install

@lcn2
Copy link

lcn2 commented Oct 2, 2023

.. ah, maybe by installed you mean that you installed it on your system?

If that's the case that's an honour (well it's all been an honour including everything with sgit) but still I'd like to know how the sgit reference in thanks file should be updated. I have some thoughts but I want to know what you're planning on doing too so it can be more accurate. I certainly have used it a fair bit to help with the website but not sure what else to say or how it'll be used in the future.

THANK YOU!

You are most welcome. It is a generally useful tool, that has some advantages over rpl(1).

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

This is helpful but I'm still unclear on some things. It says installed from but how so? I don't see it.

You do it:

cd /some/where
sgit clone https://github.com/xexyl/sgit.git
cd sgit
make install

Sorry .. I meant what did you mean. Did you do that? Install it on your system? I already have it installed on mine of course.

I'm trying to figure out what I should put in the thanks file - or rather change it to.

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

.. ah, maybe by installed you mean that you installed it on your system?
If that's the case that's an honour (well it's all been an honour including everything with sgit) but still I'd like to know how the sgit reference in thanks file should be updated. I have some thoughts but I want to know what you're planning on doing too so it can be more accurate. I certainly have used it a fair bit to help with the website but not sure what else to say or how it'll be used in the future.
THANK YOU!

You are most welcome. It is a generally useful tool, that has some advantages over rpl(1).

Ah. So you do mean you installed it? That is helpful and I'm both honoured and thrilled if that is indeed what you mean. I can update the file tomorrow most likely if that is indeed what you mean? And yes I agree it is quite useful. Thank you.

Just reading a bit and then will be shutting laptop down to do other things. Hope you have a great day!

@lcn2
Copy link

lcn2 commented Oct 2, 2023

... as for winner_name is it correct that without the -a option it should print only those with one _ in the name? Since without it it doesn't show my name or for example Thomas_A_Fine or Thomas_P_John.

Yes, the winner_name tool might need some improvements. The tool set are awaiting two things ... three things .. first is fear .. fear and surprise ... (-- Monty Python).

  1. Selection of a good Markdown to HTML tool

The selected tool will be driven by a wrapper shell script, something that might pre-process and post-process what the conversion tool does.

  1. Completion of jval, jnamval and to some extent jfmt

See mkiocccentry issue #523

  1. Finishing the manifest

Something we plan to do next once calc v2.15.x is released.

@lcn2
Copy link

lcn2 commented Oct 2, 2023

.. ah, maybe by installed you mean that you installed it on your system?
If that's the case that's an honour (well it's all been an honour including everything with sgit) but still I'd like to know how the sgit reference in thanks file should be updated. I have some thoughts but I want to know what you're planning on doing too so it can be more accurate. I certainly have used it a fair bit to help with the website but not sure what else to say or how it'll be used in the future.
THANK YOU!

You are most welcome. It is a generally useful tool, that has some advantages over rpl(1).

Ah. So you do mean you installed it? That is helpful and I'm both honoured and thrilled if that is indeed what you mean. I can update the file tomorrow most likely if that is indeed what you mean? And yes I agree it is quite useful. Thank you.

Just reading a bit and then will be shutting laptop down to do other things. Hope you have a great day!

We used it recently with man change in the calc repo.

Suggestion: All a -n flag that that, along with -v level one can see the tool going thru the motions without any files being touched. And the -n by itself, any errors would be noted.

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

.. ah, maybe by installed you mean that you installed it on your system?
If that's the case that's an honour (well it's all been an honour including everything with sgit) but still I'd like to know how the sgit reference in thanks file should be updated. I have some thoughts but I want to know what you're planning on doing too so it can be more accurate. I certainly have used it a fair bit to help with the website but not sure what else to say or how it'll be used in the future.
THANK YOU!

You are most welcome. It is a generally useful tool, that has some advantages over rpl(1).

Ah. So you do mean you installed it? That is helpful and I'm both honoured and thrilled if that is indeed what you mean. I can update the file tomorrow most likely if that is indeed what you mean? And yes I agree it is quite useful. Thank you.
Just reading a bit and then will be shutting laptop down to do other things. Hope you have a great day!

We used it recently with man change in the calc repo.

Very cool! Thanks for telling me. This also will be enough for me update the thanks file too, tomorrow.

Suggestion: All a -n flag that that, along with -v level one can see the tool going thru the motions without any files being touched. And the -n by itself, any errors would be noted.

So a dry-run option. Hmm ... not sure if that is possible with sed. But perhaps you mean something I'm not following. Would you please clarify what you mean by going through the motions without the files being touched? Perhaps you mean showing what files would be modified if the option wasn't used? Or do you mean something else?

What kind of errors are you thinking of with -n by itself?

Heading off for the day. Thanks for the suggestions and I'll look at it more tomorrow I'm sure!

Have a great afternoon!

@lcn2
Copy link

lcn2 commented Oct 2, 2023

.. ah, maybe by installed you mean that you installed it on your system?
If that's the case that's an honour (well it's all been an honour including everything with sgit) but still I'd like to know how the sgit reference in thanks file should be updated. I have some thoughts but I want to know what you're planning on doing too so it can be more accurate. I certainly have used it a fair bit to help with the website but not sure what else to say or how it'll be used in the future.
THANK YOU!

You are most welcome. It is a generally useful tool, that has some advantages over rpl(1).

Ah. So you do mean you installed it? That is helpful and I'm both honoured and thrilled if that is indeed what you mean. I can update the file tomorrow most likely if that is indeed what you mean? And yes I agree it is quite useful. Thank you.
Just reading a bit and then will be shutting laptop down to do other things. Hope you have a great day!

We used it recently with man change in the calc repo.

Very cool! Thanks for telling me. This also will be enough for me update the thanks file too, tomorrow.

Suggestion: All a -n flag that that, along with -v level one can see the tool going thru the motions without any files being touched. And the -n by itself, any errors would be noted.

So a dry-run option. Hmm ... not sure if that is possible with sed. But perhaps you mean something I'm not following. Would you please clarify what you mean by going through the motions without the files being touched? Perhaps you mean showing what files would be modified if the option wasn't used? Or do you mean something else?

What kind of errors are you thinking of with -n by itself?

Heading off for the day. Thanks for the suggestions and I'll look at it more tomorrow I'm sure!

Have a great afternoon!

Perhaps with no or low -v level:

You could simple echo the sed command that would be executed without executing them.

Perhaps with a higher -v level:

You could copy the file to a temporary filename, run sed, and remove the temp files afterwards.

Perhaps with an even higher -v level:

You could copy the file to a temporary filename, run sed, diff the result, and remove the temp files afterwards

This way if the sed command had a syntax problem, the -n would show the problem (say because shell glowing messed up the sed command), or report on the problem at the higher -v level case, or show that the sed command was not effective in the even higher `-v level case.

But in all cases the use of -n would NOT touch the original files.

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

.. ah, maybe by installed you mean that you installed it on your system?

If that's the case that's an honour (well it's all been an honour including everything with sgit) but still I'd like to know how the sgit reference in thanks file should be updated. I have some thoughts but I want to know what you're planning on doing too so it can be more accurate. I certainly have used it a fair bit to help with the website but not sure what else to say or how it'll be used in the future.

THANK YOU!

You are most welcome. It is a generally useful tool, that has some advantages over rpl(1).

Ah. So you do mean you installed it? That is helpful and I'm both honoured and thrilled if that is indeed what you mean. I can update the file tomorrow most likely if that is indeed what you mean? And yes I agree it is quite useful. Thank you.

Just reading a bit and then will be shutting laptop down to do other things. Hope you have a great day!

We used it recently with man change in the calc repo.

Very cool! Thanks for telling me. This also will be enough for me update the thanks file too, tomorrow.

Suggestion: All a -n flag that that, along with -v level one can see the tool going thru the motions without any files being touched. And the -n by itself, any errors would be noted.

So a dry-run option. Hmm ... not sure if that is possible with sed. But perhaps you mean something I'm not following. Would you please clarify what you mean by going through the motions without the files being touched? Perhaps you mean showing what files would be modified if the option wasn't used? Or do you mean something else?

What kind of errors are you thinking of with -n by itself?

Heading off for the day. Thanks for the suggestions and I'll look at it more tomorrow I'm sure!

Have a great afternoon!

Perhaps with no or low -v level:

You could simple echo the sed command that would be executed without executing them.

Perhaps with a higher -v level:

You could copy the file to a temporary filename, run sed, and remove the temp files afterwards.

Perhaps with an even higher -v level:

You could copy the file to a temporary filename, run sed, diff the result, and remove the temp files afterwards

This way if the sed command had a syntax problem, the -n would show the problem (say because shell glowing messed up the sed command), or report on the problem at the higher -v level case, or show that the sed command was not effective in the even higher `-v level case.

But in all cases the use of -n would NOT touch the original files.

Okay these are interesting ideas. I will have to think about them. Maybe sleeping on it will be useful too though I don't have much hope about that.

Thanks. Of course if you have motivation and use cases in mind to do it you're certainly welcome to do a pull request.

Tomorrow I have several things to do including working on this repo but also a zoom call in the afternoon.

Plus I do 'need' to do a bit of reading.

But I can start looking at this idea soon anyway I am sure possibly tomorrow even.

For now though I better go get ready for bed. Good night and thank you!

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

Of course doing one part is very easy: just showing what commands will run. Or it should be. I thought that I already did that but now I think on it I might be mixing it up with the script that I wrote today.

Okay so that part should be easy to do probably quickly (with the new option it would not run it but just show what would run and otherwise it would depending on verbosity level show it and do it) but the other parts will probably take a bit more thought.

I will look at it soon. Good night!

@xexyl
Copy link
Author

xexyl commented Oct 2, 2023

Quickly writing this. Just had an idea how to do the temp files.

Using the -i extension feature might be helpful. It could do a diff and then copy the backup file to the file itself.

I will sleep on this.

Really going now. Thank you for the suggestion and kind words! Good night!

@xexyl
Copy link
Author

xexyl commented Oct 3, 2023

I did think of a problem or possible problem with this idea of editing files as such as a backup and then doing a diff and ...

That problem is that it uses xargs as it has to. It should be relatively straight forward to show just what files would be modified but the other part depending on the -v flag has to be thought out more. Of course if you have suggestions I'm more than open to them. I will re-open that pull request and I have a minor improvement too I think. We can discuss it further to see if say the version of the IOCCC status should be a specific format: if so it'd solve the problem outright.

And that way you can merge the other pull request as well. I have another change that needs to be done and I'll try and squeeze in the sgit change too but I will be trying to rest quite soon before some of that.

@xexyl
Copy link
Author

xexyl commented Oct 3, 2023

Oh .. the script already does show what commands will be run! If verbosity level is >= 1.

I can try and look at showing what files will be edited or examined later on. If -n is used it would not touch the files: these two should be relatively easy to do. The other idea you have might be more complicated.

You could copy the file to a temporary filename, run sed, and remove the temp files afterwards.

This can already be done with the -i option except that it doesn't remove the temporary files afterwards. I'm trying to figure out the use of using temporary files only to delete them. Would you please elaborate here?

You could copy the file to a temporary filename, run sed, diff the result, and remove the temp files afterwards

Though not strictly the same would running git diff on the files be sufficient? Perhaps with the --no-pager option? This would include diff of modifications that were already made but this might be more useful anyway as it shows everything.

What do you think of this? It would simplify things greatly. I might even be able to do it through xargs - if I'm thinking right in my tired head it would be fine.

This way if the sed command had a syntax problem, the -n would show the problem (say because shell glowing messed up the sed command), or report on the problem at the higher -v level case, or show that the sed command was not effective in the even higher `-v level case.

If the shell globbing messed up the script might already show it but I'm not sure. What do you mean exactly please? Knowing this would be helpful in implementing it. Perhaps you have an example?

Thanks for the suggestions!

Time to rest .. well after I fix the version string in the script: noticed a problem. Then rest and then I'll try and look at the adding the -n option initially: just showing files that would be modified but not modifying them. I have an idea how that might be done though I'll have to see.

Good night (even though it's morning)! :-)

UPDATE 0

If bash script getops can allow an OPTIONAL arg to an option it might be that -n has different levels: default at 0 but otherwise take what is specified. This way it's not bound to the verbosity level. What do you think of that?

@xexyl
Copy link
Author

xexyl commented Oct 3, 2023

Initial support for -n has been added. Please let me know what you think and if you have any additional requests! I know you have more ideas but they are less clear to me so if you would elaborate please let me know.

Again also I'm ABSOLUTELY HONOURED that you have installed and used this script not only for this repo (or if not I know you will likely be doing so) but also the calc repo!

See commit xexyl/sgit@40872e6.

And now it's time to try and rest! Good day!

@xexyl
Copy link
Author

xexyl commented Oct 3, 2023

BTW: what change or changes exactly did you use sgit for (in calc)?

Anyway .. time to try and rest, little hope there is in being able to ... back later to update thanks file and maybe do other things.

Hope you're having a nice sleep!

@xexyl
Copy link
Author

xexyl commented Oct 3, 2023

.. okay made a bug fix in -n and added some examples and NOW I REALLY AM GOING TO REST (or at least try to)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants