Powershell module to let me do very simple work logging.
Written in F# - because (-:
- Start something - it needs a title
- Stop - whatever it is I last started
- Note something - assumed to be part of whatever it is I'm working, timestamp might be good, need option to not have timestamp (not sure what the default should be)
- Work through an example of an F# cmdlet
- Document Start-task functionality
- Document Stop-task functionality
- Document Add-TaskNote functionality
- Can I test with Pester ?? See Pester
- Yes if I can set up a test drive and use it as the target for my commands
- This also means that I need to understand
$psdefaultparametervalues
because if I'm requiring a target folder I don't want to have to type it every time
- Implement test functionality
- Create file if missing
- Don't create file if it already exists (file count should be unchanged, content should be persisted)
- Add title (same test, in both cases, its two tests)
- Add stop task, have to do this as a #end:HH:mm tag?
- Does not create a file if no file found
- Returns a warning if no file found
- Assumes there is an active task (for simplicity, may change later) so will always work
- Lets add an HR after, because...
- Add note capability, notes are plain text, so really simple
- Add note parameter to start
- Add note parameter to end (note should, for now, follow timestamp)
- Use verbs from library properly if you're not already
- Wrap it in a module, because this is generally "better"
- How can I publish for personal use? (Installable, updateable)
- More formatting or other hints to let me parse things after the fact 1.
- Some idiot proofing so that I get a sane log
- Can only end something that started
- Add the HR (separator) on start of next not end of current
- Reporting, of a sort
- Bonus projects:
- Can I wire it into teams calls, especially where someone calls me
- Can I create a teams both with the same logic (and ideally the same target via onedrive)
- Did I mention more structure/formatting? Something consistent with the todo list, that I also need to make work
Create Tasklog: as a PS Drive (in one's profile) in order to make life easier (ish)
Then set it as the default -TaskLogPath parameter because that really will make life easier (c.f. $psdefaultparametervalues
)
Then how do I wire the above into profiles that I use (import the module etc) but maybe keeps some clean?
Then how do I set up to publish / install / update said module trivially (there's a build process in there somewhere)
Baby steps...
Because I'm writing a Cmdlet I (probably) want to use pester to do at least some testing - of an integration type nature where I'm testing calling the comdlets rather than anything where I test the internal function of the code (allowing that these are similar).
For pester to work its assumed that the test module will be in the "publish" folder off the root: dotnet publish -o publish
Run invoke-pester from the root, things should pass. But it will lock the .dll so use pwsh -Command invoke-pester
to wrap the import of the module into a process that goes away after the test finish.s
There is a param -WarningVariable that I should be able to pass when invoking the cmdlet - pass a variable name (without the $) and the text of the warning will be written to the variable. Upon which one can then assert. Not sure if one needs to have the var initialised first (probably not).
I can do multiline notes using here strings @"..."@
. In theory at least, which makes this all the better really!